﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;

//using System.Windows.Forms;
using InkFx.WinControl.Utils;

namespace InkFx.WinControl.Core
{




    /// <summary>
    /// 
    /// </summary>
    public static class Win32API
    {
        #region  变量定义

        /// <summary>
        /// 
        /// </summary>
        public static readonly IntPtr IntPtrTrue = new IntPtr(1);
        /// <summary>
        /// 
        /// </summary>
        public static readonly IntPtr IntPtrFlase = new IntPtr(0);
        /// <summary>
        /// 
        /// </summary>
        public static readonly HandleRef NullHandleRef = new HandleRef(null, IntPtr.Zero);
        /// <summary>
        /// 
        /// </summary>
        public static readonly BindingFlags ReflectBindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy | BindingFlags.Static;

        /// <summary>
        /// 
        /// </summary>
        public static readonly System.Windows.Forms.ControlStyles ControlStylesAORSD = System.Windows.Forms.ControlStyles.AllPaintingInWmPaint | System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer | System.Windows.Forms.ControlStyles.ResizeRedraw | System.Windows.Forms.ControlStyles.SupportsTransparentBackColor | System.Windows.Forms.ControlStyles.DoubleBuffer;
        /// <summary>
        /// 
        /// </summary>
        public static readonly System.Windows.Forms.ControlStyles ControlStylesUAORSD = System.Windows.Forms.ControlStyles.UserPaint | System.Windows.Forms.ControlStyles.AllPaintingInWmPaint | System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer | System.Windows.Forms.ControlStyles.ResizeRedraw | System.Windows.Forms.ControlStyles.SupportsTransparentBackColor | System.Windows.Forms.ControlStyles.DoubleBuffer;
        /// <summary>
        /// 
        /// </summary>
        [Obsolete("注意最后的 F, 这个F可能对高度有影响")]
        public static readonly System.Windows.Forms.ControlStyles ControlStylesUAORSDF = System.Windows.Forms.ControlStyles.UserPaint | System.Windows.Forms.ControlStyles.AllPaintingInWmPaint | System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer | System.Windows.Forms.ControlStyles.ResizeRedraw | System.Windows.Forms.ControlStyles.SupportsTransparentBackColor | System.Windows.Forms.ControlStyles.DoubleBuffer | System.Windows.Forms.ControlStyles.FixedHeight;

        /// <summary>
        /// #FF00FF (255, 0, 255) 作为窗体透明色
        /// </summary>
        public static Color Transparent
        {
            get { return Color.FromArgb(255, 0, 255); }
        }

        /// <summary>
        /// Ctrl 按键是否按下
        /// </summary>
        public static bool KeyCtrl
        {
            get
            {
                var keys = System.Windows.Forms.Control.ModifierKeys;
                return false
                       || (keys & Keys.Control) == Keys.Control
                       || (keys & Keys.ControlKey) == Keys.ControlKey
                       || (keys & Keys.LControlKey) == Keys.LControlKey
                       || (keys & Keys.RControlKey) == Keys.RControlKey;
            }
        }
        /// <summary>
        /// Alt 按键是否按下
        /// </summary>
        public static bool KeyAlt
        {
            get
            {
                var keys = System.Windows.Forms.Control.ModifierKeys;
                return false
                       || (keys & Keys.Alt) == Keys.Alt;
            }
        }
        /// <summary>
        /// Shift 按键是否按下
        /// </summary>
        public static bool KeyShift
        {
            get
            {
                var keys = System.Windows.Forms.Control.ModifierKeys;
                return false
                       || (keys & Keys.Shift) == Keys.Shift
                       || (keys & Keys.ShiftKey) == Keys.ShiftKey
                       || (keys & Keys.LShiftKey) == Keys.LShiftKey
                       || (keys & Keys.RShiftKey) == Keys.RShiftKey;
            }
        }

        /// <summary>
        /// 当前鼠标左键是否按下
        /// </summary>
        public static bool MouseLeft
        {
            get
            {
                var buttons = System.Windows.Forms.Control.MouseButtons;
                return (buttons & MouseButtons.Left) == MouseButtons.Left;
            }
        }
        /// <summary>
        /// 当前鼠标右键是否按下
        /// </summary>
        public static bool MouseRight
        {
            get
            {
                var buttons = System.Windows.Forms.Control.MouseButtons;
                return (buttons & MouseButtons.Right) == MouseButtons.Right;
            }
        }
        /// <summary>
        /// 当前鼠标中键是否按下
        /// </summary>
        public static bool MouseMiddle
        {
            get
            {
                var buttons = System.Windows.Forms.Control.MouseButtons;
                return (buttons & MouseButtons.Middle) == MouseButtons.Middle;
            }
        }


        #endregion

        #region  Win7+ 阴影特效

        private static int m_EnableAero = -1;
        /// <summary>
        /// 
        /// </summary>
        public static bool EnableAero
        {
            get
            {
                if (m_EnableAero < 0)
                {
                    if (Environment.OSVersion.Version.Major >= 6)
                    {
                        int enable = 0;
                        DwmIsCompositionEnabled(ref enable);
                        m_EnableAero = enable == 1 ? 1 : 0;
                    }
                }
                return m_EnableAero == 1;
            }
        }


        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="pMarInset">Type: ref MARGINS</param>
        /// <returns></returns>
        [DllImport("dwmapi.dll")]
        public static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref MARGINS pMarInset);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hwnd">Type: IntPtr</param>
        /// <param name="attr">Type: int</param>
        /// <param name="attrValue">Type: ref int</param>
        /// <param name="attrSize">Type: int</param>
        /// <returns></returns>
        [DllImport("dwmapi.dll")]
        public static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pfEnabled">Type: ref int</param>
        /// <returns></returns>
        [DllImport("dwmapi.dll")]
        public static extern int DwmIsCompositionEnabled(ref int pfEnabled);

        //shadow struct
        /// <summary>
        /// 
        /// </summary>
        public struct MARGINS
        {
            /// <summary>
            /// 
            /// </summary>
            public int leftWidth;
            /// <summary>
            /// 
            /// </summary>
            public int rightWidth;
            /// <summary>
            /// 
            /// </summary>
            public int topHeight;
            /// <summary>
            /// 
            /// </summary>
            public int bottomHeight;
        }

        #endregion

        #region User32.dll

        /// <summary>
        /// 
        /// </summary>
        /// <param name="uType">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern bool MessageBeep(int uType);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="nIDEvent">Type: UIntPtr</param>
        /// <param name="uElapse">Type: int</param>
        /// <param name="lpTimerFunc">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern UIntPtr SetTimer(IntPtr hWnd, UIntPtr nIDEvent, int uElapse, IntPtr lpTimerFunc);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="uIDEvent">Type: UIntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern bool KillTimer(IntPtr hWnd, UIntPtr uIDEvent);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="nIndex">Type: int</param>
        /// <param name="dwNewLong">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int SetClassLong(IntPtr hWnd, int nIndex, int dwNewLong);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="nIndex">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int GetClassLong(IntPtr hWnd, int nIndex);


        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="pbmi">Type: BITMAPINFO</param>
        /// <param name="iUsage">Type: uint</param>
        /// <param name="ppvBits">Type: int</param>
        /// <param name="hSection">Type: IntPtr</param>
        /// <param name="dwOffset">Type: uint</param>
        /// <returns></returns>
        [DllImport("gdi32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr CreateDIBSection(IntPtr hWnd, BITMAPINFO pbmi, uint iUsage, int ppvBits, IntPtr hSection, uint dwOffset);


        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: UInt32</param>
        /// <param name="wParam">Type: IntPtr</param>
        /// <param name="lParam">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="wMsg">Type: int</param>
        /// <param name="wParam">Type: IntPtr</param>
        /// <param name="lParam">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="msg">Type: int</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="lParam">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public extern static int SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="msg">Type: int</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="lParam">Type: ref TOOLINFO</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public extern static int SendMessage(IntPtr hWnd, int msg, int wParam, ref TOOLINFO lParam);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="msg">Type: int</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="lParam">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public extern static int SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="msg">Type: int</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="lParam">Type: ref RECT</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public extern static int SendMessage(IntPtr hWnd, int msg, int wParam, ref RECT lParam);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="msg">Type: int</param>
        /// <param name="wParam">Type: IntPtr</param>
        /// <param name="lParam">Type: [MarshalAs(UnmanagedType.LPTStr)]string</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public extern static int SendMessage(IntPtr hWnd, int msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPTStr)]string lParam);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="msg">Type: int</param>
        /// <param name="wParam">Type: IntPtr</param>
        /// <param name="lParam">Type: ref NMHDR</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public extern static int SendMessage(IntPtr hWnd, int msg, IntPtr wParam, ref NMHDR lParam);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="msg">Type: int</param>
        /// <param name="wParam">Type: IntPtr</param>
        /// <param name="lParam">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public extern static int SendMessage(IntPtr hWnd, int msg, IntPtr wParam, int lParam);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="msg">Type: int</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="lParam">Type: ref SCROLLBARINFO</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, ref SCROLLBARINFO lParam);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="msg">Type: int</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="lParam">Type: ref HDITEM</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, ref HDITEM lParam);


        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="lParam">Type: uint</param>
        /// <returns></returns>
        [SuppressUnmanagedCodeSecurity]
        [DllImport("user32.dll", CharSet = CharSet.Unicode)]
        public static extern bool PostMessageW(IntPtr hWnd, uint Msg, int wParam, uint lParam);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: IntPtr</param>
        /// <param name="lParam">Type: IntPtr</param>
        /// <returns></returns>
        [SuppressUnmanagedCodeSecurity]
        [DllImport("user32.dll", CharSet = CharSet.Unicode)]
        public static extern bool PostMessageW(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="lParam">Type: IntPtr</param>
        /// <returns></returns>
        [SuppressUnmanagedCodeSecurity]
        [DllImport("user32.dll", CharSet = CharSet.Unicode)]
        public static extern bool PostMessageW(IntPtr hWnd, uint Msg, int wParam, IntPtr lParam);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="lParam">Type: int</param>
        /// <returns></returns>
        [SuppressUnmanagedCodeSecurity]
        [DllImport("user32.dll", CharSet = CharSet.Unicode)]
        public static extern int SendMessageW(IntPtr hWnd, uint Msg, int wParam, int lParam);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="lParam">Type: IntPtr</param>
        /// <returns></returns>
        [SuppressUnmanagedCodeSecurity]
        [DllImport("user32.dll", CharSet = CharSet.Unicode)]
        public static extern IntPtr SendMessageW(IntPtr hWnd, uint Msg, int wParam, IntPtr lParam);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: IntPtr</param>
        /// <param name="lParam">Type: IntPtr</param>
        /// <returns></returns>
        [SuppressUnmanagedCodeSecurity]
        [DllImport("user32.dll", CharSet = CharSet.Unicode)]
        public static extern IntPtr SendMessageW(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="rect">Type: ref RECT</param>
        /// <returns></returns>
        [SuppressUnmanagedCodeSecurity]
        [DllImport("user32.dll", CharSet = CharSet.Unicode)]
        public static extern IntPtr SendMessageW(IntPtr hWnd, uint Msg, int wParam, ref RECT rect);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="tcItem">Type: ref TCITEM</param>
        /// <returns></returns>
        [SuppressUnmanagedCodeSecurity]
        [DllImport("user32.dll", CharSet = CharSet.Unicode)]
        public static extern IntPtr SendMessageW(IntPtr hWnd, uint Msg, int wParam, ref TCITEM tcItem);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="tbButtonInfo">Type: ref TBBUTTONINFO</param>
        /// <returns></returns>
        [SuppressUnmanagedCodeSecurity]
        [DllImport("user32.dll", CharSet = CharSet.Unicode)]
        public static extern IntPtr SendMessageW(IntPtr hWnd, uint Msg, int wParam, ref TBBUTTONINFO tbButtonInfo);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="hdItem">Type: ref HDITEM</param>
        /// <returns></returns>
        [SuppressUnmanagedCodeSecurity]
        [DllImport("user32.dll", CharSet = CharSet.Unicode)]
        public static extern IntPtr SendMessageW(IntPtr hWnd, uint Msg, int wParam, ref HDITEM hdItem);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="tColorScheme">Type: ref COLORSCHEME</param>
        /// <returns></returns>
        [SuppressUnmanagedCodeSecurity]
        [DllImport("user32.dll", CharSet = CharSet.Unicode)]
        public static extern IntPtr SendMessageW(IntPtr hWnd, uint Msg, int wParam, ref COLORSCHEME tColorScheme);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="lpMsg">Type: out MSG</param>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="wMsgFilterMin">Type: int</param>
        /// <param name="wMsgFilterMax">Type: int</param>
        /// <param name="wRemoveMsg">Type: int</param>
        /// <returns></returns>
        [SuppressUnmanagedCodeSecurity]
        [DllImport("user32.dll", CharSet = CharSet.Unicode)]
        public static extern bool PeekMessageW(out MSG lpMsg, IntPtr hWnd, int wMsgFilterMin, int wMsgFilterMax, int wRemoveMsg);





        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="index">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll", EntryPoint = "GetWindowLong", CharSet = CharSet.Auto)]
        public static extern int GetWindowLong(IntPtr hWnd, int index);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="index">Type: int</param>
        /// <param name="dwNewLong">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll", EntryPoint = "SetWindowLong", CharSet = CharSet.Auto)]
        public static extern int SetWindowLong(IntPtr hWnd, int index, int dwNewLong);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="nIndex">Type: GWLIndex</param>
        /// <returns></returns>
        [DllImport("user32.dll", SetLastError = true)]
        public static extern int GetWindowLong(IntPtr hWnd, GWLIndex nIndex);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="nIndex">Type: GWLIndex</param>
        /// <param name="dwNewLong">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll", SetLastError = true)]
        public static extern int SetWindowLong(IntPtr hWnd, GWLIndex nIndex, int dwNewLong);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="bRevert">Type: bool</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lpPoint">Type: out Point</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern bool GetCursorPos(out Point lpPoint);


        /// <summary>
        /// 
        /// </summary>
        /// <param name="rcClip">Type: ref RECT</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern bool ClipCursor(ref RECT rcClip);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="rcClip">Type: COMRECT</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern bool ClipCursor(COMRECT rcClip);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hcursor">Type: HandleRef</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern IntPtr SetCursor(HandleRef hcursor);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="x">Type: int</param>
        /// <param name="y">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern bool SetCursorPos(int x, int y);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="bShow">Type: bool</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int ShowCursor(bool bShow);
        //[DllImport("user32.dll", CharSet = CharSet.Auto, EntryPoint = "DestroyCursor", ExactSpelling = true)]
        //private static extern bool IntDestroyCursor(HandleRef hCurs);
        //public static bool DestroyCursor(HandleRef hCurs)
        //{
        //    System.Internal.HandleCollector.Remove((IntPtr)hCurs, NativeMethods.CommonHandles.Cursor);
        //    return IntDestroyCursor(hCurs);
        //}

        //[DllImport("user32.dll")]
        //[return: MarshalAs(UnmanagedType.Bool)]
        //public static extern bool GetCursorPos(ref Point lpPoint);




        /// <summary>
        /// 
        /// </summary>
        /// <param name="hMenu">Type: IntPtr</param>
        /// <param name="uFlags">Type: uint</param>
        /// <param name="x">Type: int</param>
        /// <param name="y">Type: int</param>
        /// <param name="nReserved">Type: int</param>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="prcRect">Type: out Rectangle</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern int TrackPopupMenu(IntPtr hMenu, uint uFlags, int x, int y, int nReserved, IntPtr hWnd, out Rectangle prcRect);
        //[DllImport("user32.dll")]
        //public static extern int ShowPopupMenu(*);


        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: int</param>
        /// <param name="lParam">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern int SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: uint</param>
        /// <param name="lParam">Type: uint</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int SendMessage(IntPtr hWnd, uint Msg, uint wParam, uint lParam);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lpMsg">Type: ref System.Windows.Forms.Message</param>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="wMsgFilterMin">Type: uint</param>
        /// <param name="wMsgFilterMax">Type: uint</param>
        /// <param name="wRemoveMsg">Type: uint</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool PeekMessage(ref System.Windows.Forms.Message lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);
        //[DllImport("user32.dll", CharSet = CharSet.Auto)]
        //public static extern bool PeekMessage(ref MSG msg, int hWnd, uint wFilterMin, uint wFilterMax, uint wFlag);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: IntPtr</param>
        /// <param name="lParam">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool PostMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="Msg">Type: uint</param>
        /// <param name="wParam">Type: uint</param>
        /// <param name="lParam">Type: uint</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool PostMessage(IntPtr hWnd, uint Msg, uint wParam, uint lParam);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern IntPtr GetWindowDC(IntPtr hWnd);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="hDC">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="lprcUpdate">Type: IntPtr</param>
        /// <param name="hrgnUpdate">Type: IntPtr</param>
        /// <param name="flags">Type: uint</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool RedrawWindow(IntPtr hWnd, IntPtr lprcUpdate, IntPtr hrgnUpdate, uint flags);


        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="hWndInsertAfter">Type: IntPtr</param>
        /// <param name="x">Type: int</param>
        /// <param name="y">Type: int</param>
        /// <param name="cx">Type: int</param>
        /// <param name="cy">Type: int</param>
        /// <param name="uFlags">Type: uint</param>
        /// <returns></returns>
        [DllImport("user32.dll", SetLastError = true)]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="nCmdShow">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="lpRect">Type: ref RECT</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetWindowRect(IntPtr hWnd, ref RECT lpRect);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="hrgnClip">Type: IntPtr</param>
        /// <param name="flags">Type: DCXFlags</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, DCXFlags flags);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="hrgnClip">Type: IntPtr</param>
        /// <param name="flags">Type: uint</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hrgnClip, uint flags);

        /// <summary>
        /// 
        /// </summary>
        [DllImport("user32.dll")]
        public static extern void DisableProcessWindowsGhosting();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hwnd">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern bool IsZoomed(IntPtr hwnd);


        /// <summary>
        /// 
        /// </summary>
        /// <param name="hwnd">Type: IntPtr</param>
        /// <param name="idObject">Type: uint</param>
        /// <param name="psbi">Type: ref SCROLLBARINFO</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool GetScrollBarInfo(IntPtr hwnd, uint idObject, ref SCROLLBARINFO psbi);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hwnd">Type: IntPtr</param>
        /// <param name="fnBar">Type: int</param>
        /// <param name="lpsi">Type: ref SCROLLINFO</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool GetScrollInfo(IntPtr hwnd, int fnBar, ref SCROLLINFO lpsi);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hwnd">Type: IntPtr</param>
        /// <param name="fnBar">Type: int</param>
        /// <param name="lpsi">Type: ref SCROLLINFO</param>
        /// <param name="fRedraw">Type: bool</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int SetScrollInfo(IntPtr hwnd, int fnBar, ref SCROLLINFO lpsi, bool fRedraw);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="wBar">Type: int</param>
        /// <param name="bShow">Type: bool</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern bool ShowScrollBar(IntPtr hWnd, int wBar, bool bShow);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="nBar">Type: int</param>
        /// <param name="nPos">Type: int</param>
        /// <param name="bRedraw">Type: bool</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int SetScrollPos(IntPtr hWnd, int nBar, int nPos, bool bRedraw);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="XAmount">Type: int</param>
        /// <param name="YAmount">Type: int</param>
        /// <param name="lpRect">Type: IntPtr</param>
        /// <param name="lpClipRect">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern bool ScrollWindow(IntPtr hWnd, int XAmount, int YAmount, IntPtr lpRect, IntPtr lpClipRect);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="dx">Type: int</param>
        /// <param name="dy">Type: int</param>
        /// <param name="prcScroll">Type: IntPtr</param>
        /// <param name="prcClip">Type: IntPtr</param>
        /// <param name="hrgnUpdate">Type: IntPtr</param>
        /// <param name="prcUpdate">Type: IntPtr</param>
        /// <param name="flags">Type: uint</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int ScrollWindowEx(IntPtr hWnd, int dx, int dy, IntPtr prcScroll, IntPtr prcClip, IntPtr hrgnUpdate, IntPtr prcUpdate, uint flags);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: HandleRef</param>
        /// <param name="nXAmount">Type: int</param>
        /// <param name="nYAmount">Type: int</param>
        /// <param name="rectScrollRegion">Type: COMRECT</param>
        /// <param name="rectClip">Type: ref RECT</param>
        /// <param name="hrgnUpdate">Type: HandleRef</param>
        /// <param name="prcUpdate">Type: ref RECT</param>
        /// <param name="flags">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)]
        public static extern int ScrollWindowEx(HandleRef hWnd, int nXAmount, int nYAmount, COMRECT rectScrollRegion, ref RECT rectClip, HandleRef hrgnUpdate, ref RECT prcUpdate, int flags);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hDC">Type: IntPtr</param>
        /// <param name="dx">Type: int</param>
        /// <param name="dy">Type: int</param>
        /// <param name="lprcScroll">Type: ref RECT</param>
        /// <param name="lprcClip">Type: ref RECT</param>
        /// <param name="hrgnUpdate">Type: IntPtr</param>
        /// <param name="lprcUpdate">Type: out RECT</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern bool ScrollDC(IntPtr hDC, int dx, int dy, ref RECT lprcScroll, ref RECT lprcClip, IntPtr hrgnUpdate, out RECT lprcUpdate);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="nBar">Type: int</param>
        /// <param name="lpMinPos">Type: ref int</param>
        /// <param name="lpMaxPos">Type: ref int</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern bool GetScrollRange(IntPtr hWnd, int nBar, ref int lpMinPos, ref int lpMaxPos);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="nBar">Type: int</param>
        /// <param name="value">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true, SetLastError = true)]
        public static extern bool EnableScrollBar(IntPtr hWnd, int nBar, int value);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: HandleRef</param>
        /// <param name="fnBar">Type: int</param>
        /// <param name="si">Type: SCROLLINFO</param>
        /// <param name="redraw">Type: bool</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int SetScrollInfo(HandleRef hWnd, int fnBar, SCROLLINFO si, bool redraw);
        //[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        //public static extern bool GetScrollInfo(HandleRef hWnd, int fnBar, SCROLLINFO si);


        /// <summary>
        /// 
        /// </summary>
        /// <param name="hParent">Type: IntPtr</param>
        /// <param name="nIDParentItem">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll ", EntryPoint = "GetDlgItem")]
        public static extern IntPtr GetDlgItem(IntPtr hParent, int nIDParentItem);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hwnd">Type: IntPtr</param>
        /// <param name="pwi">Type: ref WINDOWINFO</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern bool GetWindowInfo(IntPtr hwnd, ref WINDOWINFO pwi);
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [DllImport("user32.dll", SetLastError = false)]
        public static extern IntPtr GetDesktopWindow();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern IntPtr GetDC(IntPtr handle);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="lpRect">Type: ref RECT</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern bool ValidateRect(IntPtr hWnd, ref RECT lpRect);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lpRect">Type: ref RECT</param>
        /// <param name="x">Type: int</param>
        /// <param name="y">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public extern static int OffsetRect(ref RECT lpRect, int x, int y);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lprc">Type: ref RECT</param>
        /// <param name="pt">Type: Point</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool PtInRect(ref RECT lprc, Point pt);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="nVirtKey">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern short GetKeyState(int nVirtKey);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hwnd">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool IsWindowVisible(IntPtr hwnd);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hwndParent">Type: IntPtr</param>
        /// <param name="hwndChildAfter">Type: IntPtr</param>
        /// <param name="lpszClass">Type: string</param>
        /// <param name="lpszWindow">Type: string</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="r">Type: ref RECT</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool GetClientRect(IntPtr hWnd, ref RECT r);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="hWndTo">Type: IntPtr</param>
        /// <param name="lpRect">Type: ref RECT</param>
        /// <param name="nPoints">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern int MapWindowPoints(IntPtr hWnd, IntPtr hWndTo, ref RECT lpRect, int nPoints);


        /// <summary>
        /// 
        /// </summary>
        /// <param name="lpRect">Type: ref RECT</param>
        /// <param name="dwStyle">Type: int</param>
        /// <param name="bMenu">Type: bool</param>
        /// <param name="dwExStyle">Type: int</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern bool AdjustWindowRectEx(ref RECT lpRect, int dwStyle, bool bMenu, int dwExStyle);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hIcon">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll", SetLastError = true)]
        public static extern bool DestroyIcon(IntPtr hIcon);


        /// <summary>
        /// 
        /// </summary>
        /// <param name="hwndCombo">Type: IntPtr</param>
        /// <param name="info">Type: ref COMBOBOXINFO</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern bool GetComboBoxInfo(IntPtr hwndCombo, ref COMBOBOXINFO info);


        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern int GetMessagePos();
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern bool ReleaseCapture();
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern IntPtr GetCapture();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hwnd">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
        public static extern IntPtr SetCapture(IntPtr hwnd);



        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="ps">Type: ref PAINTSTRUCT</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        public static extern IntPtr BeginPaint(IntPtr hWnd, ref PAINTSTRUCT ps);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="ps">Type: ref PAINTSTRUCT</param>
        /// <returns></returns>
        [DllImport("user32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool EndPaint(IntPtr hWnd, ref PAINTSTRUCT ps);

        #endregion

        #region Gdi32.dll


        /// <summary>
        /// 
        /// </summary>
        /// <param name="hDC"></param>
        /// <returns></returns>
        [DllImport("gdi32.dll", CharSet = CharSet.Auto)]
        public static extern int GetTextColor(IntPtr hDC);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hDC"></param>
        /// <returns></returns>
        [DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        public static extern int GetBkColor(IntPtr hDC);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hDC"></param>
        /// <param name="crColor"></param>
        /// <returns></returns>
        [DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        public static extern int SetTextColor(IntPtr hDC, int crColor);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hDC"></param>
        /// <param name="clr"></param>
        /// <returns></returns>
        [DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        public static extern int SetBkColor(IntPtr hDC, int clr);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="nIndex"></param>
        /// <returns></returns>
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr GetSysColorBrush(int nIndex);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="crColor"></param>
        /// <returns></returns>
        [DllImport("gdi32.dll", EntryPoint = "CreateSolidBrush", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern IntPtr IntCreateSolidBrush(int crColor);
        /// <summary>
        /// 注意: 这里的句柄要 手动释放
        /// </summary>
        /// <param name="crColor"></param>
        /// <returns></returns>
        public static IntPtr CreateSolidBrush(int crColor)
        {
            return IntCreateSolidBrush(crColor);
        }



        /// <summary>
        /// 
        /// </summary>
        /// <param name="hdc">Type: IntPtr</param>
        /// <param name="hrgn">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("gdi32.dll")]
        public static extern int SelectClipRgn(IntPtr hdc, IntPtr hrgn);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="x1">Type: int</param>
        /// <param name="y1">Type: int</param>
        /// <param name="x2">Type: int</param>
        /// <param name="y2">Type: int</param>
        /// <param name="cx">Type: int</param>
        /// <param name="cy">Type: int</param>
        /// <returns></returns>
        [DllImport("gdi32.dll")]
        public static extern IntPtr CreateRoundRectRgn(int x1, int y1, int x2, int y2, int cx, int cy);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hwnd">Type: IntPtr</param>
        /// <param name="nXDest">Type: int</param>
        /// <param name="nYDest">Type: int</param>
        /// <param name="nWidth">Type: int</param>
        /// <param name="nHeight">Type: int</param>
        /// <param name="hdcSrc">Type: IntPtr</param>
        /// <param name="nXSrc">Type: int</param>
        /// <param name="nYSrc">Type: int</param>
        /// <param name="dwRop">Type: int</param>
        /// <returns></returns>
        [DllImport("gdi32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool BitBlt(IntPtr hwnd, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hdc">Type: IntPtr</param>
        /// <param name="nWidth">Type: int</param>
        /// <param name="nHeight">Type: int</param>
        /// <returns></returns>
        [DllImport("gdi32.dll")]
        public static extern IntPtr CreateCompatibleBitmap(IntPtr hdc, int nWidth, int nHeight);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hdc">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("gdi32.dll")]
        public static extern IntPtr CreateCompatibleDC(IntPtr hdc);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hdc">Type: IntPtr</param>
        /// <param name="nLeftRect">Type: int</param>
        /// <param name="nTopRect">Type: int</param>
        /// <param name="nRightRect">Type: int</param>
        /// <param name="nBottomRect">Type: int</param>
        /// <returns></returns>
        [DllImport("gdi32.dll")]
        public extern static int ExcludeClipRect(IntPtr hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lpszDriver">Type: [MarshalAs(UnmanagedType.LPStr)]string</param>
        /// <param name="lpszDevice">Type: [MarshalAs(UnmanagedType.LPStr)]string</param>
        /// <param name="lpszOutput">Type: [MarshalAs(UnmanagedType.LPStr)]string</param>
        /// <param name="lpInitData">Type: int</param>
        /// <returns></returns>
        [DllImport("gdi32.dll")]
        public static extern IntPtr CreateDCA([MarshalAs(UnmanagedType.LPStr)]string lpszDriver, [MarshalAs(UnmanagedType.LPStr)]string lpszDevice, [MarshalAs(UnmanagedType.LPStr)]string lpszOutput, int lpInitData);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hdc">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("gdi32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool DeleteDC(IntPtr hdc);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hdc">Type: IntPtr</param>
        /// <param name="hgdiobj">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("gdi32.dll", ExactSpelling = true, PreserveSig = true)]
        public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hObject">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("gdi32.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool DeleteObject(IntPtr hObject);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="hdc">Type: IntPtr</param>
        /// <param name="left">Type: int</param>
        /// <param name="top">Type: int</param>
        /// <param name="width">Type: int</param>
        /// <param name="height">Type: int</param>
        /// <param name="rop">Type: int</param>
        /// <returns></returns>
        [DllImport("gdi32.dll")]
        public static extern bool PatBlt(IntPtr hdc, int left, int top, int width, int height, int rop);

        /// <summary>
        /// 在指定的 控件句柄 的 指定区域 绘制分割线 (不推荐使用本函数)
        /// </summary>
        /// <param name="handle">控件句柄</param>
        /// <param name="rect">分割条区域</param>
        public static void DrawSplitHelper(IntPtr handle, Rectangle rect)
        {
            IntPtr dCEx = Win32API.GetDCEx(handle, IntPtr.Zero, 1026);
            //IntPtr handle2 = ControlPaint.CreateHalftoneHBRUSH();
            IntPtr handle2 = (IntPtr)typeof(ControlPaint).GetMethod("CreateHalftoneHBRUSH", Win32API.ReflectBindingFlags).Invoke(null, null);
            IntPtr handle3 = Win32API.SelectObject(dCEx, handle2);
            Win32API.PatBlt(dCEx, rect.X, rect.Y, rect.Width, rect.Height, 5898313);
            Win32API.SelectObject(dCEx, handle3);
            Win32API.DeleteObject(handle2);
            Win32API.ReleaseDC(handle, dCEx);
        }


        #endregion

        #region Shell32.dll

        /// <summary>
        /// 
        /// </summary>
        /// <param name="dwMessage">Type: int</param>
        /// <param name="pData">Type: IntPtr</param>
        /// <returns></returns>
        [DllImport("shell32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
        public static extern Int32 SHAppBarMessage(int dwMessage, IntPtr pData);

        #endregion

        #region  Uxtheme.dll

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [DllImport("uxtheme.dll")]
        [return: MarshalAs(UnmanagedType.Bool)]
        public static extern bool IsAppThemed();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="hWnd">Type: IntPtr</param>
        /// <param name="pszSubAppName">Type: String</param>
        /// <param name="pszSubIdList">Type: String</param>
        /// <returns></returns>
        [DllImport("uxtheme.dll")]
        public static extern int SetWindowTheme(IntPtr hWnd, String pszSubAppName, String pszSubIdList);

        #endregion

        #region  Comctl32.dll

        /// <summary>
        /// 
        /// </summary>
        /// <param name="himl">Type: IntPtr</param>
        /// <param name="i">Type: int</param>
        /// <param name="flags">Type: int</param>
        /// <returns></returns>
        [DllImport("comctl32.dll", SetLastError = true)]
        public static extern IntPtr ImageList_GetIcon(IntPtr himl, int i, int flags);


        #endregion






        #region  自定义函数

        /// <summary>
        /// 用代码展开 ComboBox 下拉列表选项
        /// </summary>
        /// <param name="handle"></param>
        public static void ShowComboBoxDropDown(IntPtr handle)
        {
            const uint CB_SHOWDROPDOWN = 0x014f;
            const int TRUE = 1;
            const int FALSE = 0;
            SendMessage(handle, CB_SHOWDROPDOWN, TRUE, 0);
        }

        /// <summary>
        /// 获取鼠标光标的屏幕坐标
        /// </summary>
        /// <returns></returns>
        public static Point GetCursorPos()
        {
            Point point = new Point();
            Win32API.GetCursorPos(out point);
            return point;
        }

        /// <summary>
        /// 获取指定 控件或窗体 句柄 的 屏幕区域 (X Y 相对屏幕区域)
        /// <para>s&gt;</para>
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <returns></returns>
        public static RECT GetWindowRect(IntPtr handle)
        {
            RECT rect = new RECT();
            Win32API.GetWindowRect(handle, ref rect);
            return rect;
        }
        /// <summary>
        /// 获取指定 控件或窗体 句柄 的 客户区域 (X Y 相对屏幕区域)
        /// <para>s&gt;</para>
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <returns></returns>
        public static RECT GetClientRect(IntPtr handle)
        {
            RECT rect = new RECT();
            Win32API.GetClientRect(handle, ref rect);
            Win32API.MapWindowPoints(handle, IntPtr.Zero, ref rect, 2);
            return rect;
        }
        /// <summary>
        /// 获取指定 控件或窗体 句柄 的 屏幕区域 (X Y 相对屏幕区域)
        /// <para>s&gt;</para>
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <returns></returns>
        public static Rectangle GetWindowRectangle(IntPtr handle)
        {
            Rectangle result = Win32API.GetWindowRect(handle).ToRectangle();
            return result;
        }
        /// <summary>
        /// 获取指定 控件或窗体 句柄 的 客户区域 (X Y 相对客户区域)
        /// <para>s&gt;</para>
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <returns></returns>
        public static Rectangle GetClientRectangle(IntPtr handle)
        {
            Rectangle result = Win32API.GetClientRect(handle).ToRectangle();
            return result;
        }
        /// <summary>
        /// 获取指定 控件或窗体 句柄 的 相对控件本身的 外围区域 (X Y 都为 0)
        /// <para>s&gt;</para>
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <returns></returns>
        public static Rectangle GetControlWindowRectangle(IntPtr handle)
        {
            Rectangle result = Win32API.GetWindowRect(handle).ToRectangle();
            result.X = 0;
            result.Y = 0;
            return result;
        }
        /// <summary>
        /// 获取指定 控件或窗体 句柄 的 相对控件本身的 客户区域 (X Y 相对于 控件X Y 的 差距)
        /// <para>s&gt;</para>
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <returns></returns>
        public static Rectangle GetControlClientRectangle(IntPtr handle)
        {
            Rectangle windowRect = Win32API.GetWindowRect(handle).ToRectangle();
            Rectangle clientRect = Win32API.GetClientRect(handle).ToRectangle();
            clientRect.X = clientRect.X - windowRect.X;
            clientRect.Y = clientRect.Y - windowRect.Y;
            return clientRect;
        }
        /// <summary>
        /// 获取指定 控件或窗体 句柄 的 控件区域 域 客户区域 的 上下左右 的边距
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <returns></returns>
        public static BorderOffset GetControlBorderOffset(IntPtr handle)
        {
            Rectangle windowRect = Win32API.GetWindowRectangle(handle);
            Rectangle clientRect = Win32API.GetClientRectangle(handle);
            clientRect.X = clientRect.X - windowRect.X;
            clientRect.Y = clientRect.Y - windowRect.Y;

            BorderOffset borderOffset = new BorderOffset();
            borderOffset.Top = clientRect.Y;
            borderOffset.Left = clientRect.X;
            borderOffset.Bottom = clientRect.Height + clientRect.Y;
            borderOffset.Right = clientRect.Width + clientRect.X;
            return borderOffset;
        }
        /// <summary>
        /// 获取指定 控件或窗体 的 相对控件所在窗体的 外围区域 (X Y 相对Form)
        /// <para>s&gt;</para>
        /// </summary>
        /// <param name="ctrl">Type: System.Windows.Forms.Control</param>
        /// <returns></returns>
        public static Rectangle GetFormWindowRectangle(System.Windows.Forms.Control ctrl)
        {
            if (ctrl == null || ctrl.Disposing || ctrl.IsDisposed) return Rectangle.Empty;
            var form = ctrl.FindForm();
            var rectF = form.DisplayRectangle;
            var rectC = ctrl.DisplayRectangle;
            return new Rectangle(rectC.X - rectF.X, rectC.Y - rectF.Y, rectC.Width, rectC.Height);
        }
        /// <summary>
        /// 获取指定 控件或窗体 的 相对控件所在窗体的 客户区域 (X Y 相对Form)
        /// <para>s&gt;</para>
        /// </summary>
        /// <param name="ctrl">Type: System.Windows.Forms.Control</param>
        /// <returns></returns>
        public static Rectangle GetFormClientRectangle(System.Windows.Forms.Control ctrl)
        {
            if (ctrl == null || ctrl.Disposing || ctrl.IsDisposed) return Rectangle.Empty;
            var form = ctrl.FindForm();
            var rectF = form.DisplayRectangle;
            var rectC = ctrl.ClientRectangle;
            return new Rectangle(rectC.X - rectF.X, rectC.Y - rectF.Y, rectC.Width, rectC.Height);
        }

        /// <summary>
        /// 获取指定控件 在被 父控件覆盖后 的可显示区域 (该区域坐标 相对整个屏幕) (此函数性能为 90W/秒)
        /// </summary>
        /// <param name="ctrl">Type: System.Windows.Forms.Control</param>
        /// <returns></returns>
        public static Rectangle GetClipRectangle(System.Windows.Forms.Control ctrl)
        {
            try
            {
                if (ctrl == null || ctrl.Disposing || ctrl.IsDisposed) return Rectangle.Empty;

                Rectangle rect = ctrl.RectangleToScreen(new Rectangle(Point.Empty, ctrl.Size));
                var parent = ctrl.Parent;
                while (parent != null)
                {
                    rect.Intersect(parent.RectangleToScreen(new Rectangle(Point.Empty, parent.Size)));
                    parent = parent.Parent;
                }
                return rect;
            }
            catch (Exception ex) { Tools.LogWarn(ex); return Rectangle.Empty; }
        }
        /// <summary>
        /// 获取指定控件 在被 父控件覆盖后 的可显示区域 (该区域坐标 相对整个屏幕) (此函数性能为 9W/秒)
        /// </summary>
        /// <param name="ctrl">Type: System.Windows.Forms.Control</param>
        /// <returns></returns>
        public static Region GetClipRegion(System.Windows.Forms.Control ctrl)
        {
            try
            {
                if (ctrl == null || ctrl.Disposing || ctrl.IsDisposed) return null;

                Region region = null;
                var region0 = ctrl.Region;
                if (region0 != null) region = region0;
                else { var rect = GetWindowRectangle(ctrl.Handle); region = new Region(rect); }

                var parent = ctrl.Parent;
                if (parent != null)
                {
                    var ctrls = parent.Controls;
                    while (parent != null && !(parent is System.Windows.Forms.Form))
                    {
                        var region2 = GetClipRegion(parent);
                        if (region2 != null) region.Intersect(region2);
                        parent = parent.Parent;
                    }

                    var list = new List<System.Windows.Forms.Control>();
                    foreach (System.Windows.Forms.Control ctrl2 in ctrls) { if (ctrl2 == ctrl) { break; } if (ctrl2.Visible) { list.Add(ctrl2); } }
                    list.Reverse();
                    foreach (var ctrl2 in list)
                    {
                        //var region2 = GetClipRegion(ctrl); //todo: 当存在 异形的 兄弟或上级 控件时, 本函数可能会计算不准确 
                        var rect = GetWindowRectangle(ctrl2.Handle);
                        region.Exclude(rect);
                    }
                }

                return region;
            }
            catch (Exception ex) { Tools.LogWarn(ex); return null; }
        }
        /// <summary>
        /// 获取指定控件 在被 父控件覆盖后 的可显示区域 (该区域坐标 相对控件本身, 即: X Y 都为 0) (此函数性能为 9W/秒)
        /// </summary>
        /// <param name="ctrl">Type: System.Windows.Forms.Control</param>
        /// <returns></returns>
        public static Region GetClipRegion2(System.Windows.Forms.Control ctrl)
        {
            try
            {
                if (ctrl == null || ctrl.Disposing || ctrl.IsDisposed) return null;
                var rect = Win32API.GetWindowRectangle(ctrl.Handle);
                var region = Win32API.GetClipRegion(ctrl);
                if (region != null) region.Translate(0 - rect.X, 0 - rect.Y);
                return region;
            }
            catch (Exception ex) { Tools.LogWarn(ex); return null; }
        }

        /// <summary>
        /// 获取指定控件 对应的窗体 的 所有控件布局表达式
        /// </summary>
        /// <param name="ctrl">Type: System.Windows.Forms.Control</param>
        /// <returns></returns>
        public static string GetFormLayout(System.Windows.Forms.Control ctrl)
        {
            if (ctrl == null || ctrl.Disposing || ctrl.IsDisposed) return null;
            var form = (ctrl as System.Windows.Forms.Form);
            while (form == null || form.Parent != null) { form = ((form != null) ? form.FindForm() : ctrl.FindForm()); }

            var sb = new StringBuilder();
            AppendControlLayout(sb, form, 0);
            return sb.ToString();
        }
        private static void AppendControlLayout(StringBuilder sb, System.Windows.Forms.Control ctrl, int level)
        {
            if (ctrl == null || ctrl.Disposing || ctrl.IsDisposed) return;

            var name = ctrl.Name;
            if (string.IsNullOrEmpty(name)) name = "null";
            name = name.PadRight(32, ' ');

            var bounds = ctrl.Bounds;
            var str0 = string.Format("[{0}, {1}, {2}, {3}]", bounds.X, bounds.Y, bounds.Width, bounds.Height).PadRight(32, ' ');
            var str1 = string.Format("{0}{1} {2} {3}", new string(' ', level * 4), name, str0, Tools.GetKnowFullTypeName(ctrl.GetType()));
            sb.AppendLine(str1);

            foreach (System.Windows.Forms.Control ctrl2 in ctrl.Controls)
            {
                AppendControlLayout(sb, ctrl2, level + 1);
            }
        }


        /// <summary>
        /// 给定指定的尺寸, 返回一个 屏幕显示区域, 这个区域将在 当前活动窗体 的正中心的位置
        /// </summary>
        /// <param name="size">Type: Size</param>
        /// <returns></returns>
        public static Rectangle CenterActiveForm(Size size)
        {
            try
            {
                var form = System.Windows.Forms.Form.ActiveForm;
                Rectangle rect;
                if (form != null) { rect = form.Bounds; }
                else { rect = Screen.PrimaryScreen.Bounds; }
                return new Rectangle(rect.X + (rect.Width - size.Width) / 2, rect.Y + (rect.Height - size.Height) / 2, size.Width, size.Height);
            }
            catch (Exception ex) { Tools.LogWarn(ex); return Rectangle.Empty; }
        }

        /// <summary>
        /// 获取指定控件的 自身设置的 Visible
        /// <para>当父级控件的 Visible=false 时, 子控件的 Visible 也会自动变成 false, 因此 控件的Visible属性并不能反映 控件自身设置的Visible值</para>
        /// <para>本函数性能为: 每秒170W 次</para>
        /// </summary>
        /// <param name="ctrl">需要获取 显隐状态的控件</param>
        /// <returns>控件自身是否设置的可见</returns>
        public static bool GetOwnVisible(System.Windows.Forms.Control ctrl)
        {
            if (ctrl == null || ctrl.Disposing || ctrl.IsDisposed) return false;

            try
            {
                var method = typeof(Control).GetMethod("GetState", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                var result = method.Invoke(ctrl, new object[] { 2 });
                return Convert.ToBoolean(result);
            }
            catch (Exception ex) { Tools.LogWarn(ex); return ctrl.Visible; }
        }

        /// <summary>
        /// 获取指定控件的 Parent层数
        /// </summary>
        /// <param name="ctrl">需要计算父级层数的的控件</param>
        /// <returns>Parent层数</returns>
        public static int GetParentLevel(System.Windows.Forms.Control ctrl)
        {
            if (ctrl == null) return 0;
            var parent = ctrl;
            int level = 0;
            while (parent != null) { level++; parent = parent.Parent; }
            return level;
        }

        /// <summary>
        /// 获取指定 控件或窗体 句柄 的 屏幕区域尺寸
        /// <para>s&gt;</para>
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <returns></returns>
        public static Size GetSize(IntPtr handle)
        {
            RECT areatRect = GetWindowRect(handle);
            int width = areatRect.Right - areatRect.Left;
            int height = areatRect.Bottom - areatRect.Top;
            return new Size(width, height);
        }

        /// <summary>
        /// 给指定Handle的控件Win32的 Style 参数, 添加指定的 值
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <param name="style">Type: WindowStyles</param>
        public static void SetStyle(IntPtr handle, WindowStyles style)
        {
            int style2 = Win32API.GetWindowLong(handle, GWLIndex.GWL_STYLE);
            int style3 = style2 | (int)style;
            if (style2 != style3) Win32API.SetWindowLong(handle, GWLIndex.GWL_STYLE, style2);
        }
        /// <summary>
        /// 给指定Handle的控件Win32的 Style 参数, 移除指定的 值
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <param name="style">Type: WindowStyles</param>
        public static void DelStyle(IntPtr handle, WindowStyles style)
        {
            int style2 = Win32API.GetWindowLong(handle, GWLIndex.GWL_STYLE);
            int style3 = style2 & ~(int)style;
            if (style2 != style3) Win32API.SetWindowLong(handle, GWLIndex.GWL_STYLE, style2);
        }
        /// <summary>
        /// 判断指定句柄的控件, 是否包含指定的 Style 参数
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <param name="style">Type: WindowStyles</param>
        /// <returns></returns>
        public static bool HasStyle(IntPtr handle, WindowStyles style)
        {
            int style2 = Win32API.GetWindowLong(handle, GWLIndex.GWL_STYLE);
            int style3 = style2 | (int)style;
            return style2 == style3;
        }
        /// <summary>
        /// 给指定Handle的控件Win32的 ExStyle 参数, 添加指定的 值
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <param name="style">Type: WindowStyles</param>
        public static void SetExStyle(IntPtr handle, WindowStyles style)
        {
            int style2 = Win32API.GetWindowLong(handle, GWLIndex.GWL_EXSTYLE);
            int style3 = style2 | (int)style;
            if (style2 != style3) Win32API.SetWindowLong(handle, GWLIndex.GWL_EXSTYLE, style3);
        }
        /// <summary>
        /// 给指定Handle的控件Win32的 ExStyle 参数, 移除指定的 值
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <param name="style">Type: WindowStyles</param>
        public static void DelExStyle(IntPtr handle, WindowStyles style)
        {
            int style2 = Win32API.GetWindowLong(handle, GWLIndex.GWL_EXSTYLE);
            int style3 = style2 & ~(int)style;
            if (style2 != style3) Win32API.SetWindowLong(handle, GWLIndex.GWL_EXSTYLE, style2);
        }
        /// <summary>
        /// 判断指定句柄的控件, 是否包含指定的 ExStyle 参数
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <param name="style">Type: WindowStyles</param>
        /// <returns></returns>
        public static bool HasExStyle(IntPtr handle, WindowStyles style)
        {
            int style2 = Win32API.GetWindowLong(handle, GWLIndex.GWL_EXSTYLE);
            int style3 = style2 | (int)style;
            return style2 == style3;
        }



        /// <summary>
        /// 
        /// </summary>
        /// <param name="p">Type: long</param>
        /// <returns></returns>
        public static int LOBYTE(long p)
        {
            return (int)(p & 0x0000FFFF);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="p">Type: long</param>
        /// <returns></returns>
        public static int HIBYTE(long p)
        {
            return (int)(p >> 16);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lowPart">Type: uint</param>
        /// <param name="highPart">Type: uint</param>
        /// <returns></returns>
        public static int MakeLong(uint lowPart, uint highPart)
        {
            return (int)((lowPart) | (uint)((short)highPart << 16));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lowPart">Type: ushort</param>
        /// <param name="highPart">Type: int</param>
        /// <returns></returns>
        public static int MakeLong(ushort lowPart, int highPart)
        {
            return (int)((lowPart) | (uint)((short)highPart << 16));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lowPart">Type: int</param>
        /// <param name="highPart">Type: int</param>
        /// <returns></returns>
        public static int MakeLong(int lowPart, int highPart)
        {
            return (int)(((ushort)lowPart) | (uint)((short)highPart << 16));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lowPart">Type: short</param>
        /// <param name="highPart">Type: int</param>
        /// <returns></returns>
        public static int MakeLong(short lowPart, int highPart)
        {
            return (int)(((ushort)lowPart) | (uint)((short)highPart << 16));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lowPart">Type: short</param>
        /// <param name="highPart">Type: short</param>
        /// <returns></returns>
        public static int MakeLong(short lowPart, short highPart)
        {
            return (int)(((ushort)lowPart) | (uint)(highPart << 16));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lowPart">Type: short</param>
        /// <param name="highPart">Type: ushort</param>
        /// <returns></returns>
        public static int MakeLong(short lowPart, ushort highPart)
        {
            return (int)(((ushort)lowPart) | (uint)((short)highPart << 16));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lowPart">Type: short</param>
        /// <param name="highPart">Type: uint</param>
        /// <returns></returns>
        public static int MakeLong(short lowPart, uint highPart)
        {
            return (int)(((ushort)lowPart) | (uint)((short)highPart << 16));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="bLow">Type: byte</param>
        /// <param name="bHigh">Type: byte</param>
        /// <returns></returns>
        public static ushort MakeWord(byte bLow, byte bHigh)
        {
            return (ushort)(bLow | (bHigh << 8));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dword">Type: int</param>
        /// <returns></returns>
        public static short HiWord(int dword)
        {
            return (short)(dword >> 16);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dword">Type: long</param>
        /// <returns></returns>
        public static long HiWord(long dword)
        {
            return dword >> 16;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dword">Type: int</param>
        /// <returns></returns>
        public static short LoWord(int dword)
        {
            return (short)dword;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Maxuint">Type: uint</param>
        /// <returns></returns>
        public static uint High(uint Maxuint)
        {
            return uint.MaxValue;
        }


        /// <summary>
        /// 
        /// </summary>
        /// <param name="wParam">Type: IntPtr</param>
        /// <returns></returns>
        public static int TOINT32(IntPtr wParam)
        {
            return (int)(wParam.ToInt64() & (long)uint.MaxValue);
        }
        //public static int LOWORD(IntPtr wParam)
        //{
        //    return (int)(short)((long)wParam & (long)ushort.MaxValue);
        //}
        //public static int HIWORD(IntPtr wParam)
        //{
        //    return (int)(short)((long)wParam >> 16 & (long)ushort.MaxValue);
        //}
        /// <summary>
        /// 
        /// </summary>
        /// <param name="n">Type: int</param>
        /// <returns></returns>
        public static int HIWORD(int n)
        {
            return (n >> 16) & 0xffff;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="n">Type: IntPtr</param>
        /// <returns></returns>
        public static int HIWORD(IntPtr n)
        {
            return HIWORD(unchecked((int)(long)n));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="n">Type: int</param>
        /// <returns></returns>
        public static int LOWORD(int n)
        {
            return n & 0xffff;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="n">Type: IntPtr</param>
        /// <returns></returns>
        public static int LOWORD(IntPtr n)
        {
            return LOWORD(unchecked((int)(long)n));
        }




        /// <summary>
        /// 获取鼠标 相对窗体 的 坐标
        /// </summary>
        /// <param name="form">Type: Form</param>
        /// <returns></returns>
        public static Point GetMouseFormPoint(Form form)
        {
            Point screenPoint = System.Windows.Forms.Control.MousePosition;
            Point formLocation = form.Location;
            Point formPoint = new Point(screenPoint.X - formLocation.X, screenPoint.Y - formLocation.Y);
            return formPoint;
        }
        /// <summary>
        /// 获取鼠标 相对控件 的 坐标
        /// </summary>
        /// <param name="ctrl">Type: System.Windows.Forms.Control</param>
        /// <returns></returns>
        public static Point GetMouseCtrlPoint(System.Windows.Forms.Control ctrl)
        {
            Point screenPoint = System.Windows.Forms.Control.MousePosition;
            RECT rect = Win32API.GetWindowRect(ctrl.Handle);
            Point ctrlPoint = new Point(screenPoint.X - rect.X, screenPoint.Y - rect.Y);
            return ctrlPoint;
        }

        /// <summary>
        /// 将一个 屏幕区域 转换为 指定控件或窗体 的 内部区域
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <param name="screenRect">Type: Rectangle</param>
        /// <returns></returns>
        public static Rectangle ToRect(IntPtr handle, Rectangle screenRect)
        {
            RECT ctrlScreenRect = GetWindowRect(handle);
            Rectangle screenRectTemp = screenRect;
            screenRectTemp.Location = new Point(screenRect.X - ctrlScreenRect.X, screenRect.Y - ctrlScreenRect.Y);
            return screenRectTemp;
        }

        /// <summary>
        /// 向指定控件 调用 SetWindowPos(*), 强制发送 WM_NCCALCSIZE 等消息, 重算窗体尺寸 并执行 重绘 等操作
        /// <para>频繁调用本函数可能导致性能降低</para>
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        public static void ReSetWindowPos(IntPtr handle)
        {
            Win32API.SetWindowPos(
                handle,
                IntPtr.Zero,
                0, 0, 0, 0,
                (uint) ((uint) SWPFlags.SWP_NOMOVE | (uint) SWPFlags.SWP_NOSIZE | (uint) SWPFlags.SWP_NOZORDER | (uint) SWPFlags.SWP_FRAMECHANGED | (uint) SWPFlags.SWP_DRAWFRAME));
        }

        /// <summary>
        /// 向指定控件 调用 SetWindowPos(*), 强制发送 WM_NCCALCSIZE 等消息, 重算窗体尺寸 并执行 重绘 等操作
        /// <para>频繁调用本函数可能导致性能降低</para>
        /// </summary>
        /// <param name="handle">Type: IntPtr</param>
        /// <param name="x">Type: int</param>
        /// <param name="y">Type: int</param>
        /// <param name="width">Type: int</param>
        /// <param name="height">Type: int</param>
        public static void SetWindowSize(IntPtr handle, int x, int y, int width, int height)
        {
            Win32API.SetWindowPos(
                handle,
                IntPtr.Zero,
                x, y, width, height,
                20);
        }


        /// <summary>
        /// 判断指定的控件 是否是在 ToolStripDropDown 中
        /// <para>即: 如果ctrl是 弹出窗体面板中的 控件, 则本函数返回 true</para>
        /// </summary>
        /// <param name="ctrl">Type: System.Windows.Forms.Control</param>
        /// <returns></returns>
        public static bool ParentIsToolStripDropDown(System.Windows.Forms.Control ctrl)
        {
            if (ctrl == null) return false;
            var parent = ctrl;
            while (parent != null) { if (parent is System.Windows.Forms.ToolStripDropDown) { return true; } parent = parent.Parent; }
            return false;
        }
        /// <summary>
        /// 根据 文本框的光标定位, 选中 最相关的 文本内容
        /// </summary>
        /// <param name="textBox">Type: System.Windows.Forms.TextBoxBase</param>
        [Obsolete("本函数作废, 有更好的函数实现此功能: TextMatch = InnerTextBox.GetTextMatch(string text, int split)", true)]
        public static void SetTextBoxSelectedText(System.Windows.Forms.TextBoxBase textBox)
        {
            if (textBox == null || !textBox.IsHandleCreated || textBox.Disposing || textBox.IsDisposed) return;
 
            //以下代码 避免双击文本框时, 选中的文本 包含 无关字符
            try
            {
                var text = textBox.Text;
                var start = textBox.SelectionStart;
                var length = textBox.SelectionLength;
                var select = textBox.SelectedText;
                if (length <= 0 || Tools.IsNullOrWhiteSpace(select)) return;

                Match match = null;
                if (text.Contains(","))
                {
                    #region  如果文本框中有 , 则选中时以 , 为分割

                    match = Regex.Match(select, @"[\w\s-]+");
                    if (match.Success)
                    {
                        textBox.SelectionStart = start + match.Index;
                        textBox.SelectionLength = match.Length;
                    }
                    #endregion
                }
                else
                {
                    #region  否则选中时以 非\w 为分割

                    match = Regex.Match(select, @"\w+");
                    if (match.Success)
                    {
                        textBox.SelectionStart = start + match.Index;
                        textBox.SelectionLength = match.Length;
                    }
                    #endregion
                }
                
            }
            catch (Exception ex) { Tools.LogWarn2(ex, "设置文本框的选中字符发生错误"); }
        }






        ///// <summary>
        ///// 禁止一个 控件 显示默认的 边框风格(即使设置了 BorderStyle 属性, 也不让其 表现在UI上)
        ///// </summary>
        //public static void HideBorderStyle(System.Windows.Forms.Control ctrl)
        //{
        //    if (ctrl == null || ctrl.IsDisposed) return;

        //    try
        //    {
        //        PropertyInfo propertyInfo = ctrl.GetType().GetProperty("BorderStyle");
        //        if (propertyInfo != null && propertyInfo.PropertyType == typeof(BorderStyle))
        //        {
        //            BorderStyle value = (BorderStyle)propertyInfo.GetValue(ctrl, null);
        //            int currentStyle = Win32API.GetWindowLong(ctrl.Handle, GWLIndex.GWL_STYLE);
        //            int currentExStyle = Win32API.GetWindowLong(ctrl.Handle, GWLIndex.GWL_EXSTYLE);
        //            if (value == BorderStyle.FixedSingle/* && (currentStyle & 8388608) == 8388608*/)
        //            {
        //                currentStyle &= ~8388608;
        //                Win32API.SetWindowLong(ctrl.Handle, GWLIndex.GWL_STYLE, currentStyle);
        //            }
        //            if (value == BorderStyle.Fixed3D/* && (currentExStyle & 512) == 512*/)
        //            {
        //                currentExStyle &= ~512;
        //                Win32API.SetWindowLong(ctrl.Handle, GWLIndex.GWL_EXSTYLE, currentExStyle);
        //            }
        //        }
        //    }
        //    catch (Exception ex) { Tools.LogWarn(ex); }
        //}

        #endregion


    }

    /// <summary>
    /// 
    /// </summary>
    public static class Win32Msg
    {
        /// <summary>
        /// 
        /// </summary>
        public const int WM_USER = 0x400;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_REFLECT = 0x2000;

        /// <summary>
        /// 
        /// </summary>
        public const int WM_ERASEBKGND = 0x14;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_PAINT = 0xF;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_PRINTCLIENT = 0x13e;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_CTLCOLOREDIT = 0x133;

        /// <summary>
        /// 
        /// </summary>
        public const int WM_MOUSEACTIVATE = 0x21;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_MOUSEFIRST = 0x200;

        /// <summary>
        /// 
        /// </summary>
        public const int WM_GETICON = 0x007F;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_GETTEXT = 0x000D;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_GETTEXTLENGTH = 0x000E;

        /// <summary>
        /// 
        /// </summary>
        public const int WM_NOTIFY = 0x004E;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_IME_NOTIFY = 0x0282;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCACTIVATE = 0x86;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCPAINT = 0x85;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCLBUTTONDOWN = 0xA1;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCRBUTTONDOWN = 0x00A4;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_WINDOWPOSCHANGED = 0x0047;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCRBUTTONUP = 0x00A5;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCMOUSEMOVE = 0x00A0;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCLBUTTONUP = 0x00A2;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCCALCSIZE = 0x0083;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCMOUSEHOVER = 0x02A0;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCMOUSELEAVE = 0x02A2;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCHITTEST = 0x0084;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCCREATE = 0x0081;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_STYLECHANGED = 0x007D;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_STYLECHANGING = 0x7c;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_LBUTTONDBLCLK = 0x0203;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCLBUTTONDBLCLK = 0x00A3;

        /// <summary>
        /// 
        /// </summary>
        public const int WM_KEYDOWN = 0x100;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_SHOWWINDOW = 0x0018;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_ACTIVATE = 0x0006;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_ACTIVATEAPP = 0x001C;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_MDIACTIVATE = 0x0222;


        /// <summary>
        /// 
        /// </summary>
        public const int WM_MOUSEHOVER = 0x2a1;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_MOUSELEAVE = 0x2a3;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_LBUTTONUP = 0x0202;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_LBUTTONDOWN = 0x0201;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_RBUTTONUP = 0x0205;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_RBUTTONDOWN = 0x204;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_RBUTTONDBLCLK = 0x206;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_MBUTTONDOWN = 0x207;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_MBUTTONUP = 0x208;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_MBUTTONDBLCLK = 0x209;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_XBUTTONDOWN = 0x20b;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_XBUTTONUP = 0x20c;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_XBUTTONDBLCLK = 0x20d;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_MOUSEWHEEL = 0x20a;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_MOUSELAST = 0x20a;
        /// <summary>
        /// 
        /// </summary>
        public const int WHEEL_DELTA = 0x78;

        /// <summary>
        /// 
        /// </summary>
        public const int WM_CAPTURECHANGED = 0x0215;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_SETCURSOR = 0x0020;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_CLOSE = 0x0010;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_SYSCOMMAND = 0x0112;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_MOUSEMOVE = 0x0200;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_SIZE = 0x0005;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_ENABLE = 0x000A;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_SIZING = 0x0214;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_GETMINMAXINFO = 0x24;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_ENTERSIZEMOVE = 0x0231;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_WINDOWPOSCHANGING = 0x0046;

        // FOR WM_SIZING MSG WPARAM  
        /// <summary>
        /// 
        /// </summary>
        public const int WMSZ_BOTTOM = 0x6;
        /// <summary>
        /// 
        /// </summary>
        public const int WMSZ_BOTTOMLEFT = 0x7;
        /// <summary>
        /// 
        /// </summary>
        public const int WMSZ_BOTTOMRIGHT = 0x8;
        /// <summary>
        /// 
        /// </summary>
        public const int WMSZ_LEFT = 0x1;
        /// <summary>
        /// 
        /// </summary>
        public const int WMSZ_RIGHT = 0x2;
        /// <summary>
        /// 
        /// </summary>
        public const int WMSZ_TOP = 0x3;
        /// <summary>
        /// 
        /// </summary>
        public const int WMSZ_TOPLEFT = 0x4;
        /// <summary>
        /// 
        /// </summary>
        public const int WMSZ_TOPRIGHT = 0x5;

        // left mouse button is down.  
        /// <summary>
        /// 
        /// </summary>
        public const int MK_LBUTTON = 0x0001;

        /// <summary>
        /// 
        /// </summary>
        public const int SC_CLOSE = 0xF060;
        /// <summary>
        /// 
        /// </summary>
        public const int SC_MAXIMIZE = 0xF030;
        /// <summary>
        /// 
        /// </summary>
        public const int SC_MINIMIZE = 0xF020;
        /// <summary>
        /// 
        /// </summary>
        public const int SC_RESTORE = 0xF120;
        /// <summary>
        /// 
        /// </summary>
        public const int SC_CONTEXTHELP = 0xF180;

        /// <summary>
        /// 
        /// </summary>
        public const int HTCAPTION = 0x2;
        /// <summary>
        /// 
        /// </summary>
        public const int HTCLOSE = 0x14;
        /// <summary>
        /// 
        /// </summary>
        public const int HTHELP = 0x15;
        /// <summary>
        /// 
        /// </summary>
        public const int HTMAXBUTTON = 0x9;
        /// <summary>
        /// 
        /// </summary>
        public const int HTMINBUTTON = 0x8;
        /// <summary>
        /// 
        /// </summary>
        public const int HTTOP = 0xC;

        /// <summary>
        /// 
        /// </summary>
        public const int SM_CYBORDER = 0x6;
        /// <summary>
        /// 
        /// </summary>
        public const int SM_CXBORDER = 0x5;
        /// <summary>
        /// 
        /// </summary>
        public const int SM_CYCAPTION = 0x4;

        /// <summary>
        /// 
        /// </summary>
        public const int WM_VSCROLL = 0x0115;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_HSCROLL = 0x0114;

        /// <summary>
        /// 
        /// </summary>
        public const int WM_NULL = 0x0000;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_DESTROY = 0x0002;

        /// <summary>
        /// 
        /// </summary>
        public const int WM_TIMER = 0x0113;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCDESTROY = 0x0082;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_NCRBUTTONDBLCLK = 0x00A6;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_SETFONT = 0x30;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_SETFOCUS = 0x0007;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_KILLFOCUS = 0x0008;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_CHAR = 0x0102;
        /// <summary>
        /// 
        /// </summary>
        public const int WM_KEYUP = 0x0101;




        /// <summary>
        /// 
        /// </summary>
        public const int ES_LEFT = 0x0;
        /// <summary>
        /// 
        /// </summary>
        public const int ES_CENTER = 0x1;
        /// <summary>
        /// 
        /// </summary>
        public const int ES_RIGHT = 0x2;
        /// <summary>
        /// 
        /// </summary>
        public const int ES_MULTILINE = 0x4;
        /// <summary>
        /// 
        /// </summary>
        public const int ES_UPPERCASE = 0x8;
        /// <summary>
        /// 
        /// </summary>
        public const int ES_LOWERCASE = 0x10;
        /// <summary>
        /// 
        /// </summary>
        public const int ES_AUTOVSCROLL = 0x40;
        /// <summary>
        /// 
        /// </summary>
        public const int ES_AUTOHSCROLL = 0x80;
        /// <summary>
        /// 
        /// </summary>
        public const int ES_NOHIDESEL = 0x100;
        /// <summary>
        /// 
        /// </summary>
        public const int ES_READONLY = 0x800;
        /// <summary>
        /// 
        /// </summary>
        public const int ES_PASSWORD = 0x20;
        /// <summary>
        /// 
        /// </summary>
        public const int EN_CHANGE = 0x300;
        /// <summary>
        /// 
        /// </summary>
        public const int EN_UPDATE = 0x400;
        /// <summary>
        /// 
        /// </summary>
        public const int EN_HSCROLL = 0x601;
        /// <summary>
        /// 
        /// </summary>
        public const int EN_VSCROLL = 0x602;
        /// <summary>
        /// 
        /// </summary>
        public const int EN_ALIGN_LTR_EC = 0x700;
        /// <summary>
        /// 
        /// </summary>
        public const int EN_ALIGN_RTL_EC = 0x701;
        /// <summary>
        /// 
        /// </summary>
        public const int EC_LEFTMARGIN = 0x1;
        /// <summary>
        /// 
        /// </summary>
        public const int EC_RIGHTMARGIN = 0x2;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_GETSEL = 0xb0;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_SETSEL = 0xb1;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_SCROLL = 0xb5;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_SCROLLCARET = 0xb7;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_GETMODIFY = 0xb8;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_SETMODIFY = 0xb9;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_GETLINECOUNT = 0xba;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_REPLACESEL = 0xc2;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_GETLINE = 0xc4;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_LIMITTEXT = 0xc5;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_CANUNDO = 0xc6;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_UNDO = 0xc7;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_SETPASSWORDCHAR = 0xcc;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_GETPASSWORDCHAR = 0xd2;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_EMPTYUNDOBUFFER = 0xcd;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_SETREADONLY = 0xcf;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_SETMARGINS = 0xd3;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_POSFROMCHAR = 0xd6;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_CHARFROMPOS = 0xd7;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_LINEFROMCHAR = 0xc9;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_GETFIRSTVISIBLELINE = 0xce;
        /// <summary>
        /// 
        /// </summary>
        public const int EM_LINEINDEX = 0xbb;


        /// <summary>
        /// 
        /// </summary>
        public const int LV_VIEW_TILE = 4;
        /// <summary>
        /// 
        /// </summary>
        public const int LVBKIF_SOURCE_NONE = 0;
        /// <summary>
        /// 
        /// </summary>
        public const int LVBKIF_SOURCE_URL = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVBKIF_STYLE_NORMAL = 0;
        /// <summary>
        /// 
        /// </summary>
        public const int LVBKIF_STYLE_TILE = 16;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_ICON = 0;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_REPORT = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_SMALLICON = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_LIST = 3;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_SINGLESEL = 4;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_SHOWSELALWAYS = 8;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_SORTASCENDING = 16;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_SORTDESCENDING = 32;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_SHAREIMAGELISTS = 64;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_NOLABELWRAP = 128;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_AUTOARRANGE = 256;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_EDITLABELS = 512;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_NOSCROLL = 8192;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_ALIGNTOP = 0;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_ALIGNLEFT = 2048;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_NOCOLUMNHEADER = 16384;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_NOSORTHEADER = 32768;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_OWNERDATA = 4096;
        /// <summary>
        /// 
        /// </summary>
        public const int LVSCW_AUTOSIZE = -1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVSCW_AUTOSIZE_USEHEADER = -2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_REDRAWITEMS = 4117;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SCROLL = 4116;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETBKCOLOR = 4097;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETBKIMAGEA = 4164;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETBKIMAGEW = 4234;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETCALLBACKMASK = 4107;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETCALLBACKMASK = 4106;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETCOLUMNORDERARRAY = 4155;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETITEMCOUNT = 4100;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETCOLUMNORDERARRAY = 4154;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETINFOTIP = 4269;
        /// <summary>
        /// 
        /// </summary>
        public const int LVSIL_NORMAL = 0;
        /// <summary>
        /// 
        /// </summary>
        public const int LVSIL_SMALL = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVSIL_STATE = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETIMAGELIST = 4099;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETSELECTIONMARK = 4163;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETTOOLTIPS = 4170;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIF_TEXT = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIF_IMAGE = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIF_INDENT = 16;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIF_PARAM = 4;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIF_STATE = 8;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIF_GROUPID = 256;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIF_COLUMNS = 512;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIS_FOCUSED = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIS_SELECTED = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIS_CUT = 4;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIS_DROPHILITED = 8;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIS_OVERLAYMASK = 3840;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIS_STATEIMAGEMASK = 61440;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETITEMA = 4101;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETITEMW = 4171;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETITEMA = 4102;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETITEMW = 4172;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETITEMPOSITION32 = 4145;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_INSERTITEMA = 4103;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_INSERTITEMW = 4173;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_DELETEITEM = 4104;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_DELETECOLUMN = 4124;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_DELETEALLITEMS = 4105;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_UPDATE = 4138;
        /// <summary>
        /// 
        /// </summary>
        public const int LVNI_FOCUSED = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVNI_SELECTED = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETNEXTITEM = 4108;
        /// <summary>
        /// 
        /// </summary>
        public const int LVFI_PARAM = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVFI_NEARESTXY = 64;
        /// <summary>
        /// 
        /// </summary>
        public const int LVFI_PARTIAL = 8;
        /// <summary>
        /// 
        /// </summary>
        public const int LVFI_STRING = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_FINDITEMA = 4109;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_FINDITEMW = 4179;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIR_BOUNDS = 0;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIR_ICON = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIR_LABEL = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIR_SELECTBOUNDS = 3;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETITEMPOSITION = 4112;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETITEMRECT = 4110;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETSUBITEMRECT = 4152;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETSTRINGWIDTHA = 4113;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETSTRINGWIDTHW = 4183;
        /// <summary>
        /// 
        /// </summary>
        public const int LVHT_NOWHERE = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVHT_ONITEMICON = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVHT_ONITEMLABEL = 4;
        /// <summary>
        /// 
        /// </summary>
        public const int LVHT_ABOVE = 8;
        /// <summary>
        /// 
        /// </summary>
        public const int LVHT_BELOW = 16;
        /// <summary>
        /// 
        /// </summary>
        public const int LVHT_RIGHT = 32;
        /// <summary>
        /// 
        /// </summary>
        public const int LVHT_LEFT = 64;
        /// <summary>
        /// 
        /// </summary>
        public const int LVHT_ONITEM = 14;
        /// <summary>
        /// 
        /// </summary>
        public const int LVHT_ONITEMSTATEICON = 8;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SUBITEMHITTEST = 4153;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_HITTEST = 4114;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_ENSUREVISIBLE = 4115;
        /// <summary>
        /// 
        /// </summary>
        public const int LVA_DEFAULT = 0;
        /// <summary>
        /// 
        /// </summary>
        public const int LVA_ALIGNLEFT = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVA_ALIGNTOP = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVA_SNAPTOGRID = 5;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_ARRANGE = 4118;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_EDITLABELA = 4119;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_EDITLABELW = 4214;
        /// <summary>
        /// 
        /// </summary>
        public const int LVCDI_ITEM = 0;
        /// <summary>
        /// 
        /// </summary>
        public const int LVCDI_GROUP = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVCF_FMT = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVCF_WIDTH = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVCF_TEXT = 4;
        /// <summary>
        /// 
        /// </summary>
        public const int LVCF_SUBITEM = 8;
        /// <summary>
        /// 
        /// </summary>
        public const int LVCF_IMAGE = 16;
        /// <summary>
        /// 
        /// </summary>
        public const int LVCF_ORDER = 32;
        /// <summary>
        /// 
        /// </summary>
        public const int LVCFMT_IMAGE = 2048;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGA_HEADER_LEFT = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGA_HEADER_CENTER = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGA_HEADER_RIGHT = 4;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGA_FOOTER_LEFT = 8;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGA_FOOTER_CENTER = 16;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGA_FOOTER_RIGHT = 32;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGF_NONE = 0;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGF_HEADER = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGF_FOOTER = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGF_STATE = 4;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGF_ALIGN = 8;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGF_GROUPID = 16;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGS_NORMAL = 0;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGS_COLLAPSED = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVGS_HIDDEN = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVIM_AFTER = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVTVIF_FIXEDSIZE = 3;
        /// <summary>
        /// 
        /// </summary>
        public const int LVTVIM_TILESIZE = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVTVIM_COLUMNS = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_ENABLEGROUPVIEW = 4253;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_MOVEITEMTOGROUP = 4250;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETCOLUMNA = 4121;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETCOLUMNW = 4191;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETCOLUMNA = 4122;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETCOLUMNW = 4192;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_INSERTCOLUMNA = 4123;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_INSERTCOLUMNW = 4193;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_INSERTGROUP = 4241;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_REMOVEGROUP = 4246;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_INSERTMARKHITTEST = 4264;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_REMOVEALLGROUPS = 4256;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETCOLUMNWIDTH = 4125;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETCOLUMNWIDTH = 4126;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETINSERTMARK = 4262;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETHEADER = 4127; // public const int LVM_GETHEADER = (LVM_FIRST + 31);
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_FIRST = 0x1000;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETTEXTCOLOR = 4132;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETTEXTBKCOLOR = 4134;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETTOPINDEX = 4135;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETITEMPOSITION = 4111;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETITEMSTATE = 4139;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETITEMSTATE = 4140;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETITEMTEXTA = 4141;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETITEMTEXTW = 4211;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETHOTITEM = 4157;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETITEMTEXTA = 4142;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETITEMTEXTW = 4212;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETITEMCOUNT = 4143;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SORTITEMS = 4144;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETSELECTEDCOUNT = 4146;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETISEARCHSTRINGA = 4148;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETISEARCHSTRINGW = 4213;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETEXTENDEDLISTVIEWSTYLE = 4150;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETVIEW = 4238;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETGROUPINFO = 4245;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETGROUPINFO = 4243;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_HASGROUP = 4257;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETTILEVIEWINFO = 4258;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETTILEVIEWINFO = 4259;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETINSERTMARK = 4263;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETINSERTMARKRECT = 4265;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_SETINSERTMARKCOLOR = 4266;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_GETINSERTMARKCOLOR = 4267;
        /// <summary>
        /// 
        /// </summary>
        public const int LVM_ISGROUPVIEWENABLED = 4271;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_EX_GRIDLINES = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_EX_CHECKBOXES = 4;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_EX_TRACKSELECT = 8;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_EX_HEADERDRAGDROP = 16;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_EX_FULLROWSELECT = 32;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_EX_ONECLICKACTIVATE = 64;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_EX_TWOCLICKACTIVATE = 128;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_EX_INFOTIP = 1024;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_EX_UNDERLINEHOT = 2048;
        /// <summary>
        /// 
        /// </summary>
        public const int LVS_EX_DOUBLEBUFFER = 65536;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_ITEMCHANGING = -100;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_ITEMCHANGED = -101;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_BEGINLABELEDITA = -105;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_BEGINLABELEDITW = -175;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_ENDLABELEDITA = -106;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_ENDLABELEDITW = -176;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_COLUMNCLICK = -108;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_BEGINDRAG = -109;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_BEGINRDRAG = -111;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_ODFINDITEMA = -152;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_ODFINDITEMW = -179;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_ITEMACTIVATE = -114;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_GETDISPINFOA = -150;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_GETDISPINFOW = -177;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_ODCACHEHINT = -113;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_ODSTATECHANGED = -115;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_SETDISPINFOA = -151;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_SETDISPINFOW = -178;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_GETINFOTIPA = -157;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_GETINFOTIPW = -158;
        /// <summary>
        /// 
        /// </summary>
        public const int LVN_KEYDOWN = -155;
        /// <summary>
        /// 
        /// </summary>
        public const int LWA_COLORKEY = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int LWA_ALPHA = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int LANG_NEUTRAL = 0;



        /// <summary>
        /// 
        /// </summary>
        public const int HDI_ORDER = 0x0080;
        /// <summary>
        /// 
        /// </summary>
        public const int HDI_WIDTH = 0x0001;
        /// <summary>
        /// 
        /// </summary>
        public const int HDI_HEIGHT = HDI_WIDTH;
        /// <summary>
        /// 
        /// </summary>
        public const int HDM_FIRST = 0x1200;
        /// <summary>
        /// 
        /// </summary>
        public const int HDM_GETITEMCOUNT = (HDM_FIRST + 0);
        /// <summary>
        /// 
        /// </summary>
        public const int HDM_GETITEMA = (HDM_FIRST + 3);
        /// <summary>
        /// 
        /// </summary>
        public const int HDM_GETITEMRECT = (HDM_FIRST + 7);



        /// <summary>
        /// 
        /// </summary>
        public const int TBM_GETRANGEMIN = (WM_USER + 1);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_GETRANGEMAX = (WM_USER + 2);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_GETTIC = (WM_USER + 3);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_SETTIC = (WM_USER + 4);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_SETPOS = (WM_USER + 5);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_SETRANGE = (WM_USER + 6);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_SETRANGEMIN = (WM_USER + 7);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_SETRANGEMAX = (WM_USER + 8);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_CLEARTICS = (WM_USER + 9);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_SETSEL = (WM_USER + 10);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_SETSELSTART = (WM_USER + 11);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_SETSELEND = (WM_USER + 12);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_GETPTICS = (WM_USER + 14);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_GETTICPOS = (WM_USER + 15);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_GETNUMTICS = (WM_USER + 16);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_GETSELSTART = (WM_USER + 17);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_GETSELEND = (WM_USER + 18);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_CLEARSEL = (WM_USER + 19);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_SETTICFREQ = (WM_USER + 20);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_SETPAGESIZE = (WM_USER + 21);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_GETPAGESIZE = (WM_USER + 22);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_SETLINESIZE = (WM_USER + 23);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_GETLINESIZE = (WM_USER + 24);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_GETTHUMBRECT = (WM_USER + 25);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_GETCHANNELRECT = (WM_USER + 26);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_SETTHUMBLENGTH = (WM_USER + 27);
        /// <summary>
        /// 
        /// </summary>
        public const int TBM_GETTHUMBLENGTH = (WM_USER + 28);



        /// <summary>
        /// 将 Win32消息的值 转换成 可能的 Win32消息的名称
        /// </summary>
        /// <param name="msg">Type: int</param>
        /// <returns></returns>
        public static string ToMsgName(int msg)
        {
            var fields = typeof(Win32Msg).GetFields(BindingFlags.Public | BindingFlags.Static);
            foreach (var field in fields)
            {
                var value = field.GetValue(null);
                if (object.Equals(value, msg)) return field.Name;
            }
            return msg.ToString("X8");
        }
    }


    /// <summary>
    /// 
    /// </summary>
    public static class Win32ObjID
    {
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_WINDOW = 0x00000000;
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_SYSMENU = 0xFFFFFFFF;
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_TITLEBAR = 0xFFFFFFFE;
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_MENU = 0xFFFFFFFD;
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_CLIENT = 0xFFFFFFFC;
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_VSCROLL = 0xFFFFFFFB;
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_HSCROLL = 0xFFFFFFFA;
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_SIZEGRIP = 0xFFFFFFF9;
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_CARET = 0xFFFFFFF8;
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_CURSOR = 0xFFFFFFF7;
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_ALERT = 0xFFFFFFF6;
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_SOUND = 0xFFFFFFF5;
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_QUERYCLASSNAMEIDX = 0xFFFFFFF4;
        /// <summary>
        /// 
        /// </summary>
        public const uint OBJID_NATIVEOM = 0xFFFFFFF0;
    }

    
    /// <summary>
    /// 
    /// </summary>
    public static class Win32Scroll
    {
        /// <summary>
        /// 
        /// </summary>
        public const int SB_LINEUP = 0;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_LINELEFT = 0;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_LINEDOWN = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_LINERIGHT = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_PAGEUP = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_PAGELEFT = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_PAGEDOWN = 3;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_PAGERIGHT = 3;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_THUMBPOSITION = 4;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_THUMBTRACK = 5;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_TOP = 6;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_LEFT = 6;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_BOTTOM = 7;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_RIGHT = 7;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_ENDSCROLL = 8;

        /// <summary>
        /// 
        /// </summary>
        public const int SB_HORZ = 0;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_VERT = 1;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_CTL = 2;
        /// <summary>
        /// 
        /// </summary>
        public const int SB_BOTH = 3;

        /// <summary>
        /// 
        /// </summary>
        public const int SIF_RANGE = 0x0001;
        /// <summary>
        /// 
        /// </summary>
        public const int SIF_PAGE = 0x0002;
        /// <summary>
        /// 
        /// </summary>
        public const int SIF_POS = 0x0004;
        /// <summary>
        /// 
        /// </summary>
        public const int SIF_DISABLENOSCROLL = 0x0008;
        /// <summary>
        /// 
        /// </summary>
        public const int SIF_TRACKPOS = 0x0010;
        /// <summary>
        /// 
        /// </summary>
        public const int SIF_ALL = (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS);
    }


    #region Enums
    /// <summary>
    /// 
    /// </summary>
    public enum ABMsg
    {
        /// <summary>
        /// 
        /// </summary>
        ABM_NEW = 0,
        /// <summary>
        /// 
        /// </summary>
        ABM_REMOVE = 1,
        /// <summary>
        /// 
        /// </summary>
        ABM_QUERYPOS = 2,
        /// <summary>
        /// 
        /// </summary>
        ABM_SETPOS = 3,
        /// <summary>
        /// 
        /// </summary>
        ABM_GETSTATE = 4,
        /// <summary>
        /// 
        /// </summary>
        ABM_GETTASKBARPOS = 5,
        /// <summary>
        /// 
        /// </summary>
        ABM_ACTIVATE = 6,
        /// <summary>
        /// 
        /// </summary>
        ABM_GETAUTOHIDEBAR = 7,
        /// <summary>
        /// 
        /// </summary>
        ABM_SETAUTOHIDEBAR = 8,
        /// <summary>
        /// 
        /// </summary>
        ABM_WINDOWPOSCHANGED = 9,
        /// <summary>
        /// 
        /// </summary>
        ABM_SETSTATE = 10
    }
    /// <summary>
    /// 
    /// </summary>
    public enum ABEdge
    {
        /// <summary>
        /// 
        /// </summary>
        ABE_LEFT = 0,
        /// <summary>
        /// 
        /// </summary>
        ABE_TOP = 1,
        /// <summary>
        /// 
        /// </summary>
        ABE_RIGHT = 2,
        /// <summary>
        /// 
        /// </summary>
        ABE_BOTTOM = 3
    }

    /// <summary>
    /// 
    /// </summary>
    [Flags]
    public enum WindowStyles : uint
    {


        /// <summary>
        /// 
        /// </summary>
        WS_CAPTION = 0x00C00000,
        /// <summary>
        /// 
        /// </summary>
        WS_BORDER = 0x00800000,
        /// <summary>
        /// 
        /// </summary>
        WS_OVERLAPPED = 0x00000000,
        /// <summary>
        /// 
        /// </summary>
        WS_POPUP = 0x80000000,
        /// <summary>
        /// 
        /// </summary>
        WS_CHILD = 0x40000000,
        /// <summary>
        /// 
        /// </summary>
        WS_MINIMIZE = 0x20000000,
        /// <summary>
        /// 
        /// </summary>
        WS_VISIBLE = 0x10000000,
        /// <summary>
        /// 
        /// </summary>
        WS_DISABLED = 0x08000000,
        /// <summary>
        /// 
        /// </summary>
        WS_CLIPSIBLINGS = 0x04000000,
        /// <summary>
        /// 
        /// </summary>
        WS_CLIPCHILDREN = 0x02000000,
        /// <summary>
        /// 
        /// </summary>
        WS_MAXIMIZE = 0x01000000,
        /// <summary>
        /// 
        /// </summary>
        WS_DLGFRAME = 0x00400000,
        /// <summary>
        /// 
        /// </summary>
        WS_VSCROLL = 0x00200000,
        /// <summary>
        /// 
        /// </summary>
        WS_HSCROLL = 0x00100000,
        /// <summary>
        /// 
        /// </summary>
        WS_SYSMENU = 0x00080000,
        /// <summary>
        /// 
        /// </summary>
        WS_THICKFRAME = 0x00040000,
        /// <summary>
        /// 
        /// </summary>
        WS_GROUP = 0x00020000,
        /// <summary>
        /// 
        /// </summary>
        WS_TABSTOP = 0x00010000,
        /// <summary>
        /// 
        /// </summary>
        WS_MINIMIZEBOX = 0x00020000,
        /// <summary>
        /// 
        /// </summary>
        WS_MAXIMIZEBOX = 0x00010000,
        /// <summary>
        /// 
        /// </summary>
        WS_TILED = WS_OVERLAPPED,
        /// <summary>
        /// 
        /// </summary>
        WS_ICONIC = WS_MINIMIZE,
        /// <summary>
        /// 
        /// </summary>
        WS_SIZEBOX = WS_THICKFRAME,
        /// <summary>
        /// 
        /// </summary>
        WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW,
        /// <summary>
        /// 
        /// </summary>
        WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU |
                                /// <summary>
                                /// 
                                /// </summary>
                                WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX),
        /// <summary>
        /// 
        /// </summary>
        WS_POPUPWINDOW = (WS_POPUP | WS_BORDER | WS_SYSMENU),
        /// <summary>
        /// 
        /// </summary>
        WS_CHILDWINDOW = (WS_CHILD),


        /// <summary>
        /// 
        /// </summary>
        WS_EX_DLGMODALFRAME = 1,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_MDICHILD = 64,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_TOOLWINDOW = 128,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_CLIENTEDGE = 512,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_CONTEXTHELP = 1024,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_RIGHT = 4096,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_LEFT = 0,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_RTLREADING = 8192,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_LEFTSCROLLBAR = 16384,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_CONTROLPARENT = 65536,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_STATICEDGE = 131072,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_APPWINDOW = 262144,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_LAYERED = 524288,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_TOPMOST = 8,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_LAYOUTRTL = 4194304,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_NOINHERITLAYOUT = 1048576,
        /// <summary>
        /// 
        /// </summary>
        CS_DROPSHADOW = 0x00020000,
    }

    /// <summary>
    /// 
    /// </summary>
    [Flags]
    public enum WindowStyleEx
    {
        /// <summary>
        /// 
        /// </summary>
        WS_EX_DLGMODALFRAME = 0x00000001,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_NOPARENTNOTIFY = 0x00000004,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_TOPMOST = 0x00000008,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_ACCEPTFILES = 0x00000010,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_TRANSPARENT = 0x00000020,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_MDICHILD = 0x00000040,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_TOOLWINDOW = 0x00000080,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_WINDOWEDGE = 0x00000100,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_CLIENTEDGE = 0x00000200,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_CONTEXTHELP = 0x00000400,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_RIGHT = 0x00001000,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_LEFT = 0x00000000,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_RTLREADING = 0x00002000,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_LTRREADING = 0x00000000,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_LEFTSCROLLBAR = 0x00004000,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_RIGHTSCROLLBAR = 0x00000000,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_CONTROLPARENT = 0x00010000,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_STATICEDGE = 0x00020000,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_APPWINDOW = 0x00040000,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE),
        /// <summary>
        /// 
        /// </summary>
        WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST),
        /// <summary>
        /// 
        /// </summary>
        WS_EX_LAYERED = 0x00080000,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_NOINHERITLAYOUT = 0x00100000, // Disable inheritence of mirroring by children
        /// <summary>
        /// 
        /// </summary>
        WS_EX_LAYOUTRTL = 0x00400000, // Right to left mirroring
        /// <summary>
        /// 
        /// </summary>
        WS_EX_COMPOSITED = 0x02000000,
        /// <summary>
        /// 
        /// </summary>
        WS_EX_NOACTIVATE = 0x08000000,
    }


    /// <summary>
    /// 
    /// </summary>
    [Flags]
    public enum DCXFlags : long
    {
        /// <summary>
        /// 
        /// </summary>
        DCX_WINDOW = 0x00000001L,
        /// <summary>
        /// 
        /// </summary>
        DCX_CACHE = 0x00000002L,
        /// <summary>
        /// 
        /// </summary>
        DCX_CLIPSIBLINGS = 0x00000010L,
    }
    /// <summary>
    /// 
    /// </summary>
    public enum HitTest
    {
        /// <summary>
        /// 
        /// </summary>
        HTERROR = (-2),
        /// <summary>
        /// 
        /// </summary>
        HTTRANSPARENT = (-1),
        /// <summary>
        /// 
        /// </summary>
        HTNOWHERE = 0,
        /// <summary>
        /// 
        /// </summary>
        HTCLIENT = 1,
        /// <summary>
        /// 
        /// </summary>
        HTCAPTION = 2,
        /// <summary>
        /// 
        /// </summary>
        HTSYSMENU = 3,
        /// <summary>
        /// 
        /// </summary>
        HTGROWBOX = 4,
        /// <summary>
        /// 
        /// </summary>
        HTMENU = 5,
        /// <summary>
        /// 
        /// </summary>
        HTHSCROLL = 6,
        /// <summary>
        /// 
        /// </summary>
        HTVSCROLL = 7,
        /// <summary>
        /// 
        /// </summary>
        HTMINBUTTON = 8,
        /// <summary>
        /// 
        /// </summary>
        HTMAXBUTTON = 9,
        /// <summary>
        /// 
        /// </summary>
        HTLEFT = 10,
        /// <summary>
        /// 
        /// </summary>
        HTRIGHT = 11,
        /// <summary>
        /// 
        /// </summary>
        HTTOP = 12,
        /// <summary>
        /// 
        /// </summary>
        HTTOPLEFT = 13,
        /// <summary>
        /// 
        /// </summary>
        HTTOPRIGHT = 14,
        /// <summary>
        /// 
        /// </summary>
        HTBOTTOM = 15,
        /// <summary>
        /// 
        /// </summary>
        HTBOTTOMLEFT = 16,
        /// <summary>
        /// 
        /// </summary>
        HTBOTTOMRIGHT = 17,
        /// <summary>
        /// 
        /// </summary>
        HTBORDER = 18,
        /// <summary>
        /// 
        /// </summary>
        HTOBJECT = 19,
        /// <summary>
        /// 
        /// </summary>
        HTCLOSE = 20,
        /// <summary>
        /// 
        /// </summary>
        HTHELP = 21,
    }



    /// <summary>
    /// 
    /// </summary>
    public enum RedrawWindowFlags
    {
        /// <summary>
        /// 
        /// </summary>
        RDW_INVALIDATE = 0x0001,
        /// <summary>
        /// 
        /// </summary>
        RDW_INTERNALPAINT = 0x0002,
        /// <summary>
        /// 
        /// </summary>
        RDW_ERASE = 0x0004,
        /// <summary>
        /// 
        /// </summary>
        RDW_VALIDATE = 0x0008,
        /// <summary>
        /// 
        /// </summary>
        RDW_NOINTERNALPAINT = 0x0010,
        /// <summary>
        /// 
        /// </summary>
        RDW_NOERASE = 0x0020,
        /// <summary>
        /// 
        /// </summary>
        RDW_NOCHILDREN = 0x0040,
        /// <summary>
        /// 
        /// </summary>
        RDW_ALLCHILDREN = 0x0080,
        /// <summary>
        /// 
        /// </summary>
        RDW_UPDATENOW = 0x0100,
        /// <summary>
        /// 
        /// </summary>
        RDW_ERASENOW = 0x0200,
        /// <summary>
        /// 
        /// </summary>
        RDW_FRAME = 0x0400,
        /// <summary>
        /// 
        /// </summary>
        RDW_NOFRAME = 0x0800,
    }
    /// <summary>
    /// 
    /// </summary>
    public enum WAFlags
    {
        /// <summary>
        /// 
        /// </summary>
        WA_ACTIVE = 1,
        /// <summary>
        /// 
        /// </summary>
        WA_CLICKACTIVE = 2,
    }
    /// <summary>
    /// 
    /// </summary>
    public enum GWLIndex
    {
        /// <summary>
        /// 
        /// </summary>
        GWL_EXSTYLE = -20,      //设定一个新的扩展风格。
        /// <summary>
        /// 
        /// </summary>
        GWL_HINSTANCE = -6,     //设置一个新的应用程序实例句柄。
        /// <summary>
        /// 
        /// </summary>
        GWL_ID = -12,           //设置一个新的窗口标识符。
        /// <summary>
        /// 
        /// </summary>
        GWL_STYLE = -16,        //设定一个新的窗口风格。
        /// <summary>
        /// 
        /// </summary>
        GWL_USERDATA = -21,     //设置与窗口有关的32位值。每个窗口均有一个由创建该窗口的应用程序使用的32位值。
        /// <summary>
        /// 
        /// </summary>
        GWL_WNDPROC = -4,       //为窗口过程设定一个新的地址。
        /// <summary>
        /// 
        /// </summary>
        GWL_HWNDPARENT = -8,    //改变子窗口的父窗口,应使用SetParent函数。
    }

    /// <summary>
    /// 
    /// </summary>
    public enum TernaryRasterOperations
    {
        /// <summary>
        /// 
        /// </summary>
        SRCCOPY = 0x00CC0020, /* dest = source*/
        /// <summary>
        /// 
        /// </summary>
        SRCPAINT = 0x00EE0086, /* dest = source OR dest*/
        /// <summary>
        /// 
        /// </summary>
        SRCAND = 0x008800C6, /* dest = source AND dest*/
        /// <summary>
        /// 
        /// </summary>
        SRCINVERT = 0x00660046, /* dest = source XOR dest*/
        /// <summary>
        /// 
        /// </summary>
        SRCERASE = 0x00440328, /* dest = source AND (NOT dest )*/
        /// <summary>
        /// 
        /// </summary>
        NOTSRCCOPY = 0x00330008, /* dest = (NOT source)*/
        /// <summary>
        /// 
        /// </summary>
        NOTSRCERASE = 0x001100A6, /* dest = (NOT src) AND (NOT dest) */
        /// <summary>
        /// 
        /// </summary>
        MERGECOPY = 0x00C000CA, /* dest = (source AND pattern)*/
        /// <summary>
        /// 
        /// </summary>
        MERGEPAINT = 0x00BB0226, /* dest = (NOT source) OR dest*/
        /// <summary>
        /// 
        /// </summary>
        PATCOPY = 0x00F00021, /* dest = pattern*/
        /// <summary>
        /// 
        /// </summary>
        PATPAINT = 0x00FB0A09, /* dest = DPSnoo*/
        /// <summary>
        /// 
        /// </summary>
        PATINVERT = 0x005A0049, /* dest = pattern XOR dest*/
        /// <summary>
        /// 
        /// </summary>
        DSTINVERT = 0x00550009, /* dest = (NOT dest)*/
        /// <summary>
        /// 
        /// </summary>
        BLACKNESS = 0x00000042, /* dest = BLACK*/
        /// <summary>
        /// 
        /// </summary>
        WHITENESS = 0x00FF0062, /* dest = WHITE*/
    }

    /// <summary>
    /// 
    /// </summary>
    [Flags]
    public enum SWPFlags
    {
        /// <summary>
        /// 
        /// </summary>
        SWP_NOSIZE = 0x0001,
        /// <summary>
        /// 
        /// </summary>
        SWP_NOMOVE = 0x0002,
        /// <summary>
        /// 
        /// </summary>
        SWP_NOZORDER = 0x0004,
        /// <summary>
        /// 
        /// </summary>
        SWP_NOREDRAW = 0x0008,
        /// <summary>
        /// 
        /// </summary>
        SWP_NOACTIVATE = 0x0010,
        /// <summary>
        /// 
        /// </summary>
        SWP_FRAMECHANGED = 0x0020,  /* The frame changed: send WM_NCCALCSIZE */
        /// <summary>
        /// 
        /// </summary>
        SWP_SHOWWINDOW = 0x0040,
        /// <summary>
        /// 
        /// </summary>
        SWP_HIDEWINDOW = 0x0080,
        /// <summary>
        /// 
        /// </summary>
        SWP_NOCOPYBITS = 0x0100,
        /// <summary>
        /// 
        /// </summary>
        SWP_NOOWNERZORDER = 0x0200,  /* Don't do owner Z ordering */
        /// <summary>
        /// 
        /// </summary>
        SWP_NOSENDCHANGING = 0x0400,

        /// <summary>
        /// 
        /// </summary>
        SWP_DRAWFRAME = SWP_FRAMECHANGED,
        /// <summary>
        /// 
        /// </summary>
        SWP_NOREPOSITION = SWP_NOOWNERZORDER,
    }

    /// <summary>
    /// 
    /// </summary>
    public enum SysCommand
    {
        /// <summary>
        /// 
        /// </summary>
        SC_NONE = 0x0,
        /// <summary>
        /// 
        /// </summary>
        SC_CLOSE = 0xf060,
        /// <summary>
        /// 
        /// </summary>
        SC_MAXIMIZE = 0xf030,
        /// <summary>
        /// 
        /// </summary>
        SC_MINIMIZE = 0xf020,
        /// <summary>
        /// 
        /// </summary>
        SC_RESTORE = 0xf120
    }


    /// <summary>
    /// 
    /// </summary>
    [Flags]
    public enum ImageListDrawFlags : int
    {
        /// <summary>
        /// 
        /// </summary>
        ILD_NORMAL = 0x00000000,
        /// <summary>
        /// 
        /// </summary>
        ILD_TRANSPARENT = 0x00000001,
        /// <summary>
        /// 
        /// </summary>
        ILD_BLEND25 = 0x00000002,
        /// <summary>
        /// 
        /// </summary>
        ILD_FOCUS = 0x00000002,
        /// <summary>
        /// 
        /// </summary>
        ILD_BLEND50 = 0x00000004,
        /// <summary>
        /// 
        /// </summary>
        ILD_SELECTED = 0x00000004,
        /// <summary>
        /// 
        /// </summary>
        ILD_BLEND = 0x00000004,
        /// <summary>
        /// 
        /// </summary>
        ILD_MASK = 0x00000010,
        /// <summary>
        /// 
        /// </summary>
        ILD_IMAGE = 0x00000020,
        /// <summary>
        /// 
        /// </summary>
        ILD_ROP = 0x00000040,
        /// <summary>
        /// 
        /// </summary>
        ILD_OVERLAYMASK = 0x00000F00,
        /// <summary>
        /// 
        /// </summary>
        ILD_PRESERVEALPHA = 0x00001000,
        /// <summary>
        /// 
        /// </summary>
        ILD_SCALE = 0x00002000,
        /// <summary>
        /// 
        /// </summary>
        ILD_DPISCALE = 0x00004000,
        /// <summary>
        /// 
        /// </summary>
        ILD_ASYNC = 0x00008000
    }



    #endregion

    #region Structs


    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public class BITMAPINFO
    {
        /// <summary>
        /// 
        /// </summary>
        public int biSize = 0;
        /// <summary>
        /// 
        /// </summary>
        public int biWidth = 0;
        /// <summary>
        /// 
        /// </summary>
        public int biHeight = 0;
        /// <summary>
        /// 
        /// </summary>
        public short biPlanes = 0;
        /// <summary>
        /// 
        /// </summary>
        public short biBitCount = 0;
        /// <summary>
        /// 
        /// </summary>
        public int biCompression = 0;
        /// <summary>
        /// 
        /// </summary>
        public int biSizeImage = 0;
        /// <summary>
        /// 
        /// </summary>
        public int biXPelsPerMeter = 0;
        /// <summary>
        /// 
        /// </summary>
        public int biYPelsPerMeter = 0;
        /// <summary>
        /// 
        /// </summary>
        public int biClrUsed = 0;
        /// <summary>
        /// 
        /// </summary>
        public int biClrImportant = 0;
        /// <summary>
        /// 
        /// </summary>
        public byte bmiColors_rgbBlue = 0;
        /// <summary>
        /// 
        /// </summary>
        public byte bmiColors_rgbGreen = 0;
        /// <summary>
        /// 
        /// </summary>
        public byte bmiColors_rgbRed = 0;
        /// <summary>
        /// 
        /// </summary>
        public byte bmiColors_rgbReserved = 0;
    }


    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct PAINTSTRUCT
    {
        /// <summary>
        /// 
        /// </summary>
        internal IntPtr hdc;
        /// <summary>
        /// 
        /// </summary>
        internal int fErase;
        /// <summary>
        /// 
        /// </summary>
        internal RECT rcPaint;
        /// <summary>
        /// 
        /// </summary>
        internal int fRestore;
        /// <summary>
        /// 
        /// </summary>
        internal int fIncUpdate;
        /// <summary>
        /// 
        /// </summary>
        internal int Reserved1;
        /// <summary>
        /// 
        /// </summary>
        internal int Reserved2;
        /// <summary>
        /// 
        /// </summary>
        internal int Reserved3;
        /// <summary>
        /// 
        /// </summary>
        internal int Reserved4;
        /// <summary>
        /// 
        /// </summary>
        internal int Reserved5;
        /// <summary>
        /// 
        /// </summary>
        internal int Reserved6;
        /// <summary>
        /// 
        /// </summary>
        internal int Reserved7;
        /// <summary>
        /// 
        /// </summary>
        internal int Reserved8;
    }


    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct MINMAXINFO
    {
        /// <summary>
        /// 
        /// </summary>
        public Point reserved;
        /// <summary>
        /// 
        /// </summary>
        public Size maxSize;
        /// <summary>
        /// 
        /// </summary>
        public Point maxPosition;
        /// <summary>
        /// 
        /// </summary>
        public Size minTrackSize;
        /// <summary>
        /// 
        /// </summary>
        public Size maxTrackSize;
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
    public struct APPBARDATA
    {
        /// <summary>
        /// 
        /// </summary>
        public int cbSize;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr hWnd;
        /// <summary>
        /// 
        /// </summary>
        public int uCallbackMessage;
        /// <summary>
        /// 
        /// </summary>
        public int uEdge;
        /// <summary>
        /// 
        /// </summary>
        public RECT rc;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr lParam;
    }


    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct NCCALCSIZE_PARAMS
    {
        /// <summary>
        /// 
        /// </summary>
        public RECT rect0;
        /// <summary>
        /// 
        /// </summary>
        public RECT rect1;
        /// <summary>
        /// 
        /// </summary>
        public RECT rect2;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr lppos;
        //public WINDOWPOS lppos;

        /// <summary>
        /// 通过 lppos 指针, 获取 对应的 WINDOWPOS
        /// </summary>
        /// <returns></returns>
        public WINDOWPOS GetLPos()
        {
            WINDOWPOS pos = (WINDOWPOS)Marshal.PtrToStructure(lppos, typeof(WINDOWPOS));
            return pos;
        }
        /// <summary>
        /// 给 lppos 指针, 赋值最新的结构体 WINDOWPOS
        /// </summary>
        /// <param name="pos">Type: WINDOWPOS</param>
        public void SetLPos(WINDOWPOS pos)
        {
            Marshal.StructureToPtr(pos, lppos, true);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pos">Type: WINDOWPOS</param>
        /// <returns></returns>
        public WINDOWPOS SetAndReLPos(WINDOWPOS pos)
        {
            Marshal.StructureToPtr(pos, lppos, true);
            WINDOWPOS pos2 = (WINDOWPOS)Marshal.PtrToStructure(lppos, typeof(WINDOWPOS));
            return pos2;
        }
    };

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct WINDOWPOS
    {
        /// <summary>
        /// 
        /// </summary>
        public IntPtr hWnd;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr hwndInsertAfter;
        /// <summary>
        /// 
        /// </summary>
        public int x;
        /// <summary>
        /// 
        /// </summary>
        public int y;
        /// <summary>
        /// 
        /// </summary>
        public int cx;
        /// <summary>
        /// 
        /// </summary>
        public int cy;
        /// <summary>
        /// 
        /// </summary>
        public int flags;
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct RECT
    {
        /// <summary>
        /// 用作特定类型的哈希函数。
        /// </summary>
        /// <returns>当前 System.Object 的哈希代码。</returns>
        public override int GetHashCode()
        {
            unchecked
            {
                int hashCode = _Left;
                hashCode = (hashCode*397) ^ _Top;
                hashCode = (hashCode*397) ^ _Right;
                hashCode = (hashCode*397) ^ _Bottom;
                return hashCode;
            }
        }

        private int _Left;
        private int _Top;
        private int _Right;
        private int _Bottom;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="Rectangle">Type: Rectangle</param>
        public RECT(Rectangle Rectangle)
            : this(Rectangle.Left, Rectangle.Top, Rectangle.Right, Rectangle.Bottom)
        {
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="Left">Type: int</param>
        /// <param name="Top">Type: int</param>
        /// <param name="Right">Type: int</param>
        /// <param name="Bottom">Type: int</param>
        public RECT(int Left, int Top, int Right, int Bottom)
        {
            _Left = Left;
            _Top = Top;
            _Right = Right;
            _Bottom = Bottom;
        }

        /// <summary>
        /// 
        /// </summary>
        public int X
        {
            get { return _Left; }
            set { _Left = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int Y
        {
            get { return _Top; }
            set { _Top = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int Left
        {
            get { return _Left; }
            set { _Left = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int Top
        {
            get { return _Top; }
            set { _Top = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int Right
        {
            get { return _Right; }
            set { _Right = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int Bottom
        {
            get { return _Bottom; }
            set { _Bottom = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int Height
        {
            get { return _Bottom - _Top; }
            set { _Bottom = value - _Top; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int Width
        {
            get { return _Right - _Left; }
            set { _Right = value + _Left; }
        }
        /// <summary>
        /// 
        /// </summary>
        public Point Location
        {
            get { return new Point(Left, Top); }
            set
            {
                _Left = value.X;
                _Top = value.Y;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public Size Size
        {
            get { return new Size(Width, Height); }
            set
            {
                _Right = value.Height + _Left;
                _Bottom = value.Height + _Top;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public Rectangle ToRectangle()
        {
            return new Rectangle(this.Left, this.Top, this.Width, this.Height);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Rectangle">Type: RECT</param>
        /// <returns></returns>
        public static Rectangle ToRectangle(RECT Rectangle)
        {
            return Rectangle.ToRectangle();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Rectangle">Type: Rectangle</param>
        /// <returns></returns>
        public static RECT FromRectangle(Rectangle Rectangle)
        {
            return new RECT(Rectangle.Left, Rectangle.Top, Rectangle.Right, Rectangle.Bottom);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="Rectangle">Type: RECT</param>
        /// <returns></returns>
        public static implicit operator Rectangle(RECT Rectangle)
        {
            return Rectangle.ToRectangle();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Rectangle">Type: Rectangle</param>
        /// <returns></returns>
        public static implicit operator RECT(Rectangle Rectangle)
        {
            return new RECT(Rectangle);
        }
        /// <summary>
        /// 
        /// </summary>
        public static bool operator ==(RECT Rectangle1, RECT Rectangle2)
        {
            return Rectangle1.Equals(Rectangle2);
        }
        /// <summary>
        /// 
        /// </summary>
        public static bool operator !=(RECT Rectangle1, RECT Rectangle2)
        {
            return !Rectangle1.Equals(Rectangle2);
        }

        /// <summary>
        /// 返回表示当前 System.Object 的 System.String。
        /// </summary>
        /// <returns>System.String，表示当前的 System.Object。</returns>
        public override string ToString()
        {
            return "{X: " + X + "; Y: " + Y + "; Width: " + Width + "; Height: " + Height + "; Left: " + _Left + "; Top: " + _Top + "; Right: " + _Right + "; Bottom: " + _Bottom + "}";
        }

        /// <summary>
        /// 确定指定的 System.Object 是否等于当前的 System.Object。
        /// </summary>
        /// <param name="Rectangle">Type: RECT</param>
        /// <returns>如果指定的 System.Object 等于当前的 System.Object，则为 true；否则为 false。</returns>
        public bool Equals(RECT Rectangle)
        {
            return _Left == Rectangle._Left && _Top == Rectangle._Top && _Right == Rectangle._Right && _Bottom == Rectangle._Bottom;
        }
        /// <summary>
        /// 确定指定的 System.Object 是否等于当前的 System.Object。
        /// </summary>
        /// <param name="Object">Type: object</param>
        /// <returns>如果指定的 System.Object 等于当前的 System.Object，则为 true；否则为 false。</returns>
        public override bool Equals(object Object)
        {
            if (ReferenceEquals(null, Object)) return false;
            return Object is RECT && Equals((RECT) Object);
        }
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public class COMRECT
    {
        /// <summary>
        /// 
        /// </summary>
        public int left;
        /// <summary>
        /// 
        /// </summary>
        public int top;
        /// <summary>
        /// 
        /// </summary>
        public int right;
        /// <summary>
        /// 
        /// </summary>
        public int bottom;
        /// <summary>
        /// 构造函数
        /// </summary>
        public COMRECT()
        {
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="r">Type: Rectangle</param>
        public COMRECT(Rectangle r)
        {
            this.left = r.X;
            this.top = r.Y;
            this.right = r.Right;
            this.bottom = r.Bottom;
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="left">Type: int</param>
        /// <param name="top">Type: int</param>
        /// <param name="right">Type: int</param>
        /// <param name="bottom">Type: int</param>
        public COMRECT(int left, int top, int right, int bottom)
        {
            this.left = left;
            this.top = top;
            this.right = right;
            this.bottom = bottom;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="x">Type: int</param>
        /// <param name="y">Type: int</param>
        /// <param name="width">Type: int</param>
        /// <param name="height">Type: int</param>
        /// <returns></returns>
        public static COMRECT FromXYWH(int x, int y, int width, int height)
        {
            return new COMRECT(x, y, x + width, y + height);
        }
        /// <summary>
        /// 返回表示当前 System.Object 的 System.String。
        /// </summary>
        /// <returns>System.String，表示当前的 System.Object。</returns>
        public override string ToString()
        {
            return string.Format("Left = {0} Top = {1} Right = {2} Bottom = {3}", this.left, this.top, this.right, this.bottom);
        }
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct TOOLINFO
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="flags">Type: int</param>
        internal TOOLINFO(int flags)
        {
            this.cbSize = Marshal.SizeOf(typeof(TOOLINFO));
            this.uFlags = flags;
            this.hWnd = IntPtr.Zero;
            this.uId = IntPtr.Zero;
            this.rect = new RECT(0, 0, 0, 0);
            this.hinst = IntPtr.Zero;
            this.lpszText = IntPtr.Zero;
            this.lParam = IntPtr.Zero;
        }

        /// <summary>
        /// 
        /// </summary>
        public int cbSize;
        /// <summary>
        /// 
        /// </summary>
        public int uFlags;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr hWnd;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr uId;
        /// <summary>
        /// 
        /// </summary>
        public RECT rect;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr hinst;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr lpszText;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr lParam;
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct NMHDR
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="flag">Type: int</param>
        public NMHDR(int flag)
        {
            this.hwndFrom = IntPtr.Zero;
            this.idFrom = 0;
            this.code = 0;
        }

        /// <summary>
        /// 
        /// </summary>
        public IntPtr hwndFrom;
        /// <summary>
        /// 
        /// </summary>
        public int idFrom;
        /// <summary>
        /// 
        /// </summary>
        public int code;
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct SCROLLBARINFO
    {
        /// <summary>
        /// 
        /// </summary>
        public int cbSize;
        /// <summary>
        /// 
        /// </summary>
        public RECT rcScrollBar;
        /// <summary>
        /// 
        /// </summary>
        public int dxyLineButton;
        /// <summary>
        /// 
        /// </summary>
        public int xyThumbTop;
        /// <summary>
        /// 
        /// </summary>
        public int xyThumbBottom;
        /// <summary>
        /// 
        /// </summary>
        public int reserved;
        /// <summary>
        /// 
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
        internal int[] rgstate;
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct SCROLLINFO
    {
        /// <summary>
        /// 
        /// </summary>
        public uint cbSize;
        /// <summary>
        /// 
        /// </summary>
        public uint fMask;
        /// <summary>
        /// 
        /// </summary>
        public int nMin;
        /// <summary>
        /// 
        /// </summary>
        public int nMax;
        /// <summary>
        /// 
        /// </summary>
        public uint nPage;
        /// <summary>
        /// 
        /// </summary>
        public int nPos;
        /// <summary>
        /// 
        /// </summary>
        public int nTrackPos;

        public override string ToString()
        {
            return string.Format("Min={0} Max={1} Value={2} Track={3} Mask={4} Size={5} Page={6}", nMin, nMax, nPos, nTrackPos, fMask, cbSize, nPage);
        }
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct HDITEM
    {
        /// <summary>
        /// 
        /// </summary>
        public int mask;
        /// <summary>
        /// 
        /// </summary>
        public int cxy;
        /// <summary>
        /// 
        /// </summary>
        public string pszText;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr hbm;
        /// <summary>
        /// 
        /// </summary>
        public int cchTextMax;
        /// <summary>
        /// 
        /// </summary>
        public int fmt;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr lParam;
        /// <summary>
        /// 
        /// </summary>
        public int iImage;
        /// <summary>
        /// 
        /// </summary>
        public int iOrder;
        /// <summary>
        /// 
        /// </summary>
        public uint type;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr pvFilter;
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct TCITEM
    {
        /// <summary>
        /// 
        /// </summary>
        public uint mask;
        /// <summary>
        /// 
        /// </summary>
        public uint dwState;
        /// <summary>
        /// 
        /// </summary>
        public uint dwStateMask;
        /// <summary>
        /// 
        /// </summary>
        [MarshalAs(UnmanagedType.LPWStr)]
        public string pszText;
        /// <summary>
        /// 
        /// </summary>
        public int cchTextMax;
        /// <summary>
        /// 
        /// </summary>
        public int iImage;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr lParam;
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct MSG
    {
        /// <summary>
        /// 
        /// </summary>
        public IntPtr hWnd;
        /// <summary>
        /// 
        /// </summary>
        public uint message;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr wParam;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr lParam;
        /// <summary>
        /// 
        /// </summary>
        public uint time;
        /// <summary>
        /// 
        /// </summary>
        public POINT pt;
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct POINT
    {
        /// <summary>
        /// 
        /// </summary>
        public int X;
        /// <summary>
        /// 
        /// </summary>
        public int Y;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="x">Type: int</param>
        /// <param name="y">Type: int</param>
        public POINT(int x, int y)
        {
            this.X = x;
            this.Y = y;
        }
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct SIZE
    {
        /// <summary>
        /// 
        /// </summary>
        public int cx;
        /// <summary>
        /// 
        /// </summary>
        public int cy;
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct MARGINS
    {
        /// <summary>
        /// 
        /// </summary>
        public int cxLeftWidth;
        /// <summary>
        /// 
        /// </summary>
        public int cxRightWidth;
        /// <summary>
        /// 
        /// </summary>
        public int cyTopHeight;
        /// <summary>
        /// 
        /// </summary>
        public int cyBottomHeight;
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct COLORSCHEME
    {
        /// <summary>
        /// 
        /// </summary>
        public int dwSize;
        /// <summary>
        /// 
        /// </summary>
        public int clrBtnHighlight;
        /// <summary>
        /// 
        /// </summary>
        public int clrBtnShadow;
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct TBBUTTONINFO
    {
        /// <summary>
        /// 
        /// </summary>
        public int cbSize;
        /// <summary>
        /// 
        /// </summary>
        public uint dwMask;
        /// <summary>
        /// 
        /// </summary>
        public int idCommand;
        /// <summary>
        /// 
        /// </summary>
        public int iImage;
        /// <summary>
        /// 
        /// </summary>
        public byte fsState;
        /// <summary>
        /// 
        /// </summary>
        public byte fsStyle;
        /// <summary>
        /// 
        /// </summary>
        public short cx;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr lParam;
        /// <summary>
        /// 
        /// </summary>
        [MarshalAs(UnmanagedType.LPWStr)]
        public string pszText;
        /// <summary>
        /// 
        /// </summary>
        public int cchText;
    }


    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct WINDOWINFO
    {
        /// <summary>
        /// 
        /// </summary>
        public UInt32 cbSize;
        /// <summary>
        /// 
        /// </summary>
        public RECT rcWindow;
        /// <summary>
        /// 
        /// </summary>
        public RECT rcClient;
        /// <summary>
        /// 
        /// </summary>
        public UInt32 dwStyle;
        /// <summary>
        /// 
        /// </summary>
        public UInt32 dwExStyle;
        /// <summary>
        /// 
        /// </summary>
        public UInt32 dwWindowStatus;
        /// <summary>
        /// 
        /// </summary>
        public UInt32 cxWindowBorders;
        /// <summary>
        /// 
        /// </summary>
        public UInt32 cyWindowBorders;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr atomWindowType;
        /// <summary>
        /// 
        /// </summary>
        public UInt16 wCreatorVersion;
    }

    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public struct COMBOBOXINFO
    {
        /// <summary>
        /// 
        /// </summary>
        public int cbSize;
        /// <summary>
        /// 
        /// </summary>
        public RECT rcItem;
        /// <summary>
        /// 
        /// </summary>
        public RECT rcButton;
        /// <summary>
        /// 
        /// </summary>
        public COMBOBOXBUTTONSTATE stateButton;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr hwndCombo;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr hwndEdit;
        /// <summary>
        /// 
        /// </summary>
        public IntPtr hwndList;
    }
    /// <summary>
    /// 
    /// </summary>
    public enum COMBOBOXBUTTONSTATE
    {
        /// <summary>
        /// 
        /// </summary>
        STATE_SYSTEM_NONE = 0,
        /// <summary>
        /// 
        /// </summary>
        STATE_SYSTEM_INVISIBLE = 0x00008000,
        /// <summary>
        /// 
        /// </summary>
        STATE_SYSTEM_PRESSED = 0x00000008
    }


    /// <summary>
    /// 
    /// </summary>
    [StructLayout(LayoutKind.Sequential)]
    public class SYSTEMTIME
    {
        /// <summary>
        /// 
        /// </summary>
        public short wYear;
        /// <summary>
        /// 
        /// </summary>
        public short wMonth;
        /// <summary>
        /// 
        /// </summary>
        public short wDayOfWeek;
        /// <summary>
        /// 
        /// </summary>
        public short wDay;
        /// <summary>
        /// 
        /// </summary>
        public short wHour;
        /// <summary>
        /// 
        /// </summary>
        public short wMinute;
        /// <summary>
        /// 
        /// </summary>
        public short wSecond;
        /// <summary>
        /// 
        /// </summary>
        public short wMilliseconds;

        /// <summary>
        /// 返回表示当前 System.Object 的 System.String。
        /// </summary>
        /// <returns>System.String，表示当前的 System.Object。</returns>
        public override string ToString()
        {
            return "[SYSTEMTIME: " + this.wDay.ToString((IFormatProvider)CultureInfo.InvariantCulture) + "/" + this.wMonth.ToString((IFormatProvider)CultureInfo.InvariantCulture) + "/" + this.wYear.ToString((IFormatProvider)CultureInfo.InvariantCulture) + " " + this.wHour.ToString((IFormatProvider)CultureInfo.InvariantCulture) + ":" + this.wMinute.ToString((IFormatProvider)CultureInfo.InvariantCulture) + ":" + this.wSecond.ToString((IFormatProvider)CultureInfo.InvariantCulture) + "]";
        }
    }

    #endregion


}